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

Movement script: linear or curved splines. More...

Inheritance diagram for splineMove:

Public Types

enum  LocalType { none, toPath, toObject }
 
enum  TimeValue { time, speed }
 
enum  LoopType {
  none, loop, pingPong, random,
  yoyo
}
 
enum  RotationType { none, all }
 

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 currently paused movement routine. More...
 
void Reverse ()
 Reverses movement at any time. More...
 
void SetPath (PathManager newPath)
 Changes the current path of this 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)
 Change running tween speed by manipulating its timeScale. More...
 
bool IsMoving ()
 Returns whether the movement tween is active. Also true when moving to path 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...
 
LocalType localType = LocalType.none
 Whether local positioning relative to path or object should be used when tweening this object. More...
 
float lookAhead = 0
 Value to look ahead on the path when orientToPath is enabled (0-1). More...
 
float sizeToAdd = 0
 Additional units to add on the y-axis. More...
 
TimeValue timeValue = TimeValue.speed
 Selection for speed-based movement or time in seconds per segment. More...
 
float speed = 5
 Speed or time value depending on the selected TimeValue type. More...
 
AnimationCurve animEaseType
 Custom curve when AnimationCurve has been selected as easeType. More...
 
LoopType loopType = LoopType.none
 Supported movement looptypes when moving on the path. More...
 
Vector3[] waypoints
 Waypoint array references of the requested path. More...
 
DG.Tweening.PathType pathType = DG.Tweening.PathType.CatmullRom
 Animation path type, linear or curved. More...
 
DG.Tweening.PathMode pathMode = DG.Tweening.PathMode.Full3D
 Whether this object should orient itself to a different Unity axis. More...
 
DG.Tweening.Ease easeType = DG.Tweening.Ease.Linear
 Animation easetype on TimeValue type time. More...
 
DG.Tweening.AxisConstraint lockPosition = DG.Tweening.AxisConstraint.None
 Option for locking a position axis. More...
 
DG.Tweening.AxisConstraint lockRotation = DG.Tweening.AxisConstraint.None
 Option for locking a rotation axis with orientToPath enabled. More...
 
RotationType waypointRotation = RotationType.none
 Whether to lerp this target from one waypoint rotation to the next, effectively overwriting the pathMode setting for all or one axis only. More...
 
Transform rotationTarget
 The target transform to rotate using waypoint rotation, if selected. This should be a child object with (0,0,0) rotation that gets overridden. More...
 
UnityEvent movementStart
 UnityEvent invoked on each new movement iteration. Note that this includes a call when moveToPath starts. It is also called on both endpoints on loop type = ping pong. 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. It is also called on both endpoints on loop type = ping pong. More...
 
Tweener tween
 

Events

Action movementStartEvent
 
Action< int > movementChangeEvent
 
Action movementEndEvent
 

Detailed Description

Movement script: linear or curved splines.

Member Enumeration Documentation

enum LocalType
strong
Enumerator
none 
toPath 
toObject 
enum LoopType
strong
Enumerator
none 
loop 
pingPong 
random 
yoyo 
enum RotationType
strong
Enumerator
none 
all 
enum TimeValue
strong
Enumerator
time 
speed 

Member Function Documentation

void ChangeSpeed ( float  value)

Change running tween speed by manipulating its timeScale.

void GoToWaypoint ( int  index)

Teleports to the defined waypoint index on the path.

bool IsMoving ( )

Returns whether the movement tween is active. Also true when moving to path 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 currently paused movement routine.

void Reverse ( )

Reverses movement at any time.

void SetPath ( PathManager  newPath)

Changes the current path of this 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

AnimationCurve animEaseType

Custom curve when AnimationCurve has been selected as easeType.

bool closeLoop = false

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

int currentPoint = 0

Current waypoint indicator on the path.

DG.Tweening.Ease easeType = DG.Tweening.Ease.Linear

Animation easetype on TimeValue type time.

Whether local positioning relative to path or object should be used when tweening this object.

DG.Tweening.AxisConstraint lockPosition = DG.Tweening.AxisConstraint.None

Option for locking a position axis.

DG.Tweening.AxisConstraint lockRotation = DG.Tweening.AxisConstraint.None

Option for locking a rotation axis with orientToPath enabled.

float lookAhead = 0

Value to look ahead on the path when orientToPath is enabled (0-1).

LoopType loopType = LoopType.none

Supported movement looptypes when moving on the path.

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. It is also called on both endpoints on loop type = ping pong.

UnityEvent movementStart

UnityEvent invoked on each new movement iteration. Note that this includes a call when moveToPath starts. It is also called on both endpoints on loop type = ping pong.

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.

DG.Tweening.PathMode pathMode = DG.Tweening.PathMode.Full3D

Whether this object should orient itself to a different Unity axis.

DG.Tweening.PathType pathType = DG.Tweening.PathType.CatmullRom

Animation path type, linear or curved.

bool reverse = false

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

Transform rotationTarget

The target transform to rotate using waypoint rotation, if selected. This should be a child object with (0,0,0) rotation that gets overridden.

float sizeToAdd = 0

Additional units to add on the y-axis.

float speed = 5

Speed or time value depending on the selected TimeValue type.

int startPoint = 0

Waypoint index where this object should start its path.

Selection for speed-based movement or time in seconds per segment.

Tweener tween
RotationType waypointRotation = RotationType.none

Whether to lerp this target from one waypoint rotation to the next, effectively overwriting the pathMode setting for all or one axis only.

Vector3 [] 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: