Highroad Engine v1.3
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
MoreMountains.Tools.MMPathMovement Class Reference

Add this component to an object and it'll be able to move along a path defined from its inspector. More...

Inheritance diagram for MoreMountains.Tools.MMPathMovement:

Public Types

enum  PossibleAccelerationType { ConstantSpeed , EaseOut , AnimationCurve }
 the possible movement types More...
 
enum  CycleOptions {
  BackAndForth , Loop , OnlyOnce , StopAtBounds ,
  Random
}
 the possible cycle options More...
 
enum  MovementDirection { Ascending , Descending }
 the possible movement directions More...
 
enum  UpdateModes { Update , FixedUpdate , LateUpdate }
 

Public Member Functions

virtual void ResetPath ()
 A public method you can call to reset the path More...
 
virtual void MoveAlongThePath ()
 Moves the object along the path according to the specified movement type. More...
 
virtual IEnumerator< Vector3 > GetPathEnumerator ()
 Returns the current target point in the path More...
 
virtual void ChangeDirection ()
 Call this method to force a change in direction at any time More...
 
virtual void UpdateOriginalTransformPosition (Vector3 newOriginalTransformPosition)
 Updates the original transform position. More...
 
virtual Vector3 GetOriginalTransformPosition ()
 Gets the original transform position. More...
 
virtual void SetOriginalTransformPositionStatus (bool status)
 Sets the original transform position status. More...
 
virtual bool GetOriginalTransformPositionStatus ()
 Gets the original transform position status. More...
 

Public Attributes

CycleOptions CycleOption
 
MovementDirection LoopInitialMovementDirection = MovementDirection.Ascending
 the initial movement direction : ascending > will go from the points 0 to 1, 2, etc ; descending > will go from the last point to last-1, last-2, etc More...
 
List< MMPathMovementElementPathElements
 the points that make up the path the object will follow More...
 
float MovementSpeed = 1
 the movement speed More...
 
PossibleAccelerationType AccelerationType = PossibleAccelerationType.ConstantSpeed
 the movement type of the object More...
 
AnimationCurve Acceleration = new AnimationCurve(new Keyframe(0,1f),new Keyframe(1f,0f))
 the acceleration to apply to an object traveling between two points of the path. More...
 
UpdateModes UpdateMode = UpdateModes.Update
 the chosen update mode (update, fixed update, late update) More...
 
float MinDistanceToGoal = .1f
 the minimum distance to a point at which we'll arbitrarily decide the point's been reached More...
 

Protected Member Functions

virtual void Awake ()
 Initialization More...
 
virtual void Start ()
 On Start we store our initial position More...
 
virtual void Initialization ()
 Flag inits, initial movement determination, and object positioning More...
 
virtual void FixedUpdate ()
 
virtual void LateUpdate ()
 
virtual void Update ()
 
virtual void PointReached ()
 Override this to describe what happens when a point is reached More...
 
virtual void EndReached ()
 Override this to describe what happens when the end of the path is reached More...
 
virtual void ExecuteUpdate ()
 On update we keep moving along the path More...
 
virtual void Move ()
 Moves the object and determines when a point has been reached More...
 
virtual void OnDrawGizmos ()
 On DrawGizmos, we draw lines to show the path the object will follow More...
 

Protected Attributes

Vector3 _originalTransformPosition
 the original position of the transform, hidden and shouldn't be accessed More...
 
bool _originalTransformPositionStatus =false
 internal flag, hidden and shouldn't be accessed More...
 
bool _active =false
 
IEnumerator< Vector3 > _currentPoint
 
int _direction = 1
 
Vector3 _initialPosition
 
Vector3 _finalPosition
 
Vector3 _previousPoint = Vector3.zero
 
float _waiting =0
 
int _currentIndex
 
float _distanceToNextPoint
 
bool _endReached = false
 

Properties

Vector3 CurrentSpeed [getprotected set]
 returns the current speed at which the object is traveling More...
 
virtual bool CanMove [getset]
 if this is true, the object can move along the path More...
 

Detailed Description

Add this component to an object and it'll be able to move along a path defined from its inspector.

Member Enumeration Documentation

◆ CycleOptions

the possible cycle options

Enumerator
BackAndForth 
Loop 
OnlyOnce 
StopAtBounds 
Random 

◆ MovementDirection

the possible movement directions

Enumerator
Ascending 
Descending 

◆ PossibleAccelerationType

the possible movement types

Enumerator
ConstantSpeed 
EaseOut 
AnimationCurve 

◆ UpdateModes

Enumerator
Update 
FixedUpdate 
LateUpdate 

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.MMPathMovement.Awake ( )
protectedvirtual

Initialization

◆ ChangeDirection()

virtual void MoreMountains.Tools.MMPathMovement.ChangeDirection ( )
virtual

Call this method to force a change in direction at any time

◆ EndReached()

virtual void MoreMountains.Tools.MMPathMovement.EndReached ( )
protectedvirtual

Override this to describe what happens when the end of the path is reached

◆ ExecuteUpdate()

virtual void MoreMountains.Tools.MMPathMovement.ExecuteUpdate ( )
protectedvirtual

On update we keep moving along the path

◆ FixedUpdate()

virtual void MoreMountains.Tools.MMPathMovement.FixedUpdate ( )
protectedvirtual

◆ GetOriginalTransformPosition()

virtual Vector3 MoreMountains.Tools.MMPathMovement.GetOriginalTransformPosition ( )
virtual

Gets the original transform position.

Returns
The original transform position.

◆ GetOriginalTransformPositionStatus()

virtual bool MoreMountains.Tools.MMPathMovement.GetOriginalTransformPositionStatus ( )
virtual

Gets the original transform position status.

Returns
true, if original transform position status was gotten, false otherwise.

◆ GetPathEnumerator()

virtual IEnumerator< Vector3 > MoreMountains.Tools.MMPathMovement.GetPathEnumerator ( )
virtual

Returns the current target point in the path

Returns
The path enumerator.

◆ Initialization()

virtual void MoreMountains.Tools.MMPathMovement.Initialization ( )
protectedvirtual

Flag inits, initial movement determination, and object positioning

◆ LateUpdate()

virtual void MoreMountains.Tools.MMPathMovement.LateUpdate ( )
protectedvirtual

◆ Move()

virtual void MoreMountains.Tools.MMPathMovement.Move ( )
protectedvirtual

Moves the object and determines when a point has been reached

◆ MoveAlongThePath()

virtual void MoreMountains.Tools.MMPathMovement.MoveAlongThePath ( )
virtual

Moves the object along the path according to the specified movement type.

◆ OnDrawGizmos()

virtual void MoreMountains.Tools.MMPathMovement.OnDrawGizmos ( )
protectedvirtual

On DrawGizmos, we draw lines to show the path the object will follow

◆ PointReached()

virtual void MoreMountains.Tools.MMPathMovement.PointReached ( )
protectedvirtual

Override this to describe what happens when a point is reached

◆ ResetPath()

virtual void MoreMountains.Tools.MMPathMovement.ResetPath ( )
virtual

A public method you can call to reset the path

◆ SetOriginalTransformPositionStatus()

virtual void MoreMountains.Tools.MMPathMovement.SetOriginalTransformPositionStatus ( bool  status)
virtual

Sets the original transform position status.

Parameters
statusIf set to true status.

◆ Start()

virtual void MoreMountains.Tools.MMPathMovement.Start ( )
protectedvirtual

On Start we store our initial position

◆ Update()

virtual void MoreMountains.Tools.MMPathMovement.Update ( )
protectedvirtual

◆ UpdateOriginalTransformPosition()

virtual void MoreMountains.Tools.MMPathMovement.UpdateOriginalTransformPosition ( Vector3  newOriginalTransformPosition)
virtual

Updates the original transform position.

Parameters
newOriginalTransformPositionNew original transform position.

Member Data Documentation

◆ _active

bool MoreMountains.Tools.MMPathMovement._active =false
protected

◆ _currentIndex

int MoreMountains.Tools.MMPathMovement._currentIndex
protected

◆ _currentPoint

IEnumerator<Vector3> MoreMountains.Tools.MMPathMovement._currentPoint
protected

◆ _direction

int MoreMountains.Tools.MMPathMovement._direction = 1
protected

◆ _distanceToNextPoint

float MoreMountains.Tools.MMPathMovement._distanceToNextPoint
protected

◆ _endReached

bool MoreMountains.Tools.MMPathMovement._endReached = false
protected

◆ _finalPosition

Vector3 MoreMountains.Tools.MMPathMovement._finalPosition
protected

◆ _initialPosition

Vector3 MoreMountains.Tools.MMPathMovement._initialPosition
protected

◆ _originalTransformPosition

Vector3 MoreMountains.Tools.MMPathMovement._originalTransformPosition
protected

the original position of the transform, hidden and shouldn't be accessed

◆ _originalTransformPositionStatus

bool MoreMountains.Tools.MMPathMovement._originalTransformPositionStatus =false
protected

internal flag, hidden and shouldn't be accessed

◆ _previousPoint

Vector3 MoreMountains.Tools.MMPathMovement._previousPoint = Vector3.zero
protected

◆ _waiting

float MoreMountains.Tools.MMPathMovement._waiting =0
protected

◆ Acceleration

AnimationCurve MoreMountains.Tools.MMPathMovement.Acceleration = new AnimationCurve(new Keyframe(0,1f),new Keyframe(1f,0f))

the acceleration to apply to an object traveling between two points of the path.

◆ AccelerationType

PossibleAccelerationType MoreMountains.Tools.MMPathMovement.AccelerationType = PossibleAccelerationType.ConstantSpeed

the movement type of the object

◆ CycleOption

CycleOptions MoreMountains.Tools.MMPathMovement.CycleOption

◆ LoopInitialMovementDirection

MovementDirection MoreMountains.Tools.MMPathMovement.LoopInitialMovementDirection = MovementDirection.Ascending

the initial movement direction : ascending > will go from the points 0 to 1, 2, etc ; descending > will go from the last point to last-1, last-2, etc

◆ MinDistanceToGoal

float MoreMountains.Tools.MMPathMovement.MinDistanceToGoal = .1f

the minimum distance to a point at which we'll arbitrarily decide the point's been reached

◆ MovementSpeed

float MoreMountains.Tools.MMPathMovement.MovementSpeed = 1

the movement speed

◆ PathElements

List<MMPathMovementElement> MoreMountains.Tools.MMPathMovement.PathElements

the points that make up the path the object will follow

◆ UpdateMode

UpdateModes MoreMountains.Tools.MMPathMovement.UpdateMode = UpdateModes.Update

the chosen update mode (update, fixed update, late update)

Property Documentation

◆ CanMove

virtual bool MoreMountains.Tools.MMPathMovement.CanMove
getset

if this is true, the object can move along the path

◆ CurrentSpeed

Vector3 MoreMountains.Tools.MMPathMovement.CurrentSpeed
getprotected set

returns the current speed at which the object is traveling


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