Simple Waypoint System  5.5
Public Types | Public Member Functions | Public Attributes | Events | List of all members
navMove

Movement script: pathfinding using Unity NavMesh agents. More...

Inheritance diagram for navMove:

Public Types

enum  LoopType { none, loop, pingPong, random }
 Supported movement looptypes when moving on the path. More...
 

Public Member Functions

void StartMove ()
 Starts movement. Can be called from other scripts to allow start delay. More...
 
void GoToWaypoint (int index)
 Teleports to the defined waypoint index on the path. More...
 
void Pause (float seconds=0f)
 Pauses the current movement routine for a defined amount of time. More...
 
void Resume ()
 Resumes the current movement routine. More...
 
void Reverse ()
 Reverses movement at any time. More...
 
void SetPath (PathManager newPath)
 Changes the current path of this walker object and starts movement. More...
 
void Stop ()
 Disables any running movement routines. More...
 
void ResetToStart ()
 Stops movement and resets to the first waypoint. More...
 
void ChangeSpeed (float value)
 Wrapper to change agent speed. More...
 
bool IsMoving ()
 Returns whether the movement coroutines are active. Still true when moveToPath or paused. More...
 
bool IsMovingToPath ()
 Returns whether the movement tween is active and moving to path. Returns false afterwards. More...
 
bool IsPaused ()
 Returns true if the movement is currently paused. More...
 

Public Attributes

PathManager pathContainer
 Path component to use for movement. More...
 
bool onStart = false
 Whether this object should start its movement at game launch. More...
 
bool moveToPath = false
 Whether this object should walk to the first waypoint or spawn there. More...
 
bool reverse = false
 reverse the movement direction on the path, typically used for "pingPong" behavior. More...
 
int startPoint = 0
 Waypoint index where this object should start its path. More...
 
int currentPoint = 0
 Current waypoint indicator on the path. More...
 
bool closeLoop = false
 Option for closing the path on the "loop" looptype. More...
 
bool updateRotation = true
 Whether rotation should be overridden by the NavMesh agent. More...
 
LoopType loopType = LoopType.none
 
Transform[] waypoints
 Waypoint array references of the requested path. More...
 
UnityEvent movementStart
 UnityEvent invoked on each new movement iteration. Note that this includes a call when moveToPath starts. More...
 
WaypointEvent movementChange
 UnityEvent invoked per waypoint, delivering the current waypoint index. Note that on loop types, this could mean double invokes for the same waypoint. E.g. on ping-pong loop type you can check the reverse flag for more control. More...
 
UnityEvent movementEnd
 UnityEvent invoked on each ending movement iteration. Note that this is not called when moveToPath ends. More...
 

Events

Action movementStartEvent
 
Action< int > movementChangeEvent
 
Action movementEndEvent
 

Detailed Description

Movement script: pathfinding using Unity NavMesh agents.

Member Enumeration Documentation

enum LoopType
strong

Supported movement looptypes when moving on the path.

Enumerator
none 
loop 
pingPong 
random 

Member Function Documentation

void ChangeSpeed ( float  value)

Wrapper to change agent speed.

void GoToWaypoint ( int  index)

Teleports to the defined waypoint index on the path.

bool IsMoving ( )

Returns whether the movement coroutines are active. Still true when moveToPath or paused.

bool IsMovingToPath ( )

Returns whether the movement tween is active and moving to path. Returns false afterwards.

bool IsPaused ( )

Returns true if the movement is currently paused.

void Pause ( float  seconds = 0f)

Pauses the current movement routine for a defined amount of time.

void ResetToStart ( )

Stops movement and resets to the first waypoint.

void Resume ( )

Resumes the current movement routine.

void Reverse ( )

Reverses movement at any time.

void SetPath ( PathManager  newPath)

Changes the current path of this walker object and starts movement.

void StartMove ( )

Starts movement. Can be called from other scripts to allow start delay.

void Stop ( )

Disables any running movement routines.

Member Data Documentation

bool closeLoop = false

Option for closing the path on the "loop" looptype.

int currentPoint = 0

Current waypoint indicator on the path.

LoopType loopType = LoopType.none
WaypointEvent movementChange

UnityEvent invoked per waypoint, delivering the current waypoint index. Note that on loop types, this could mean double invokes for the same waypoint. E.g. on ping-pong loop type you can check the reverse flag for more control.

UnityEvent movementEnd

UnityEvent invoked on each ending movement iteration. Note that this is not called when moveToPath ends.

UnityEvent movementStart

UnityEvent invoked on each new movement iteration. Note that this includes a call when moveToPath starts.

bool moveToPath = false

Whether this object should walk to the first waypoint or spawn there.

bool onStart = false

Whether this object should start its movement at game launch.

PathManager pathContainer

Path component to use for movement.

bool reverse = false

reverse the movement direction on the path, typically used for "pingPong" behavior.

int startPoint = 0

Waypoint index where this object should start its path.

bool updateRotation = true

Whether rotation should be overridden by the NavMesh agent.

Transform [] waypoints

Waypoint array references of the requested path.

Event Documentation

Action<int> movementChangeEvent
Action movementEndEvent
Action movementStartEvent

The documentation for this class was generated from the following file: