C# Class UnityPlatformer.MovingPlatform

Moving Platform Tile
Inheritance: RaycastController, IUpdateEntity
Show file Open project: llafuente/unity-platformer

Public Properties

Property Type Description
disableDownRayCast bool
onReachWaypoint ReachWaypoint
onResume System.Action
onStop System.Action
path Line
speed float
startStopped bool

Public Methods

Method Description
CalculatePassengerMovement ( Vector3 velocity ) : void

Calculate how much each passenger should move

DoAction ( MovingPlatformActions action ) : void

Perform an action over MovingPlatform like: Resume, stop, reverse....

IsStopped ( ) : bool

Reverse waypoints, current waypoint and percentBetweenWaypoints This is used when reach the end, so we don't need handle both logics

LatePlatformerUpdate ( float delta ) : void

Do nothing

MovePassengers ( bool beforeMovePlatform ) : void

Move passenger

OnDisable ( ) : void

notify UpdateManager

OnEnable ( ) : void

notify UpdateManager

PlatformerUpdate ( float delta ) : void

Get passenger list, pre update, move and post update

Resume ( ) : void

Resume movement with default speed

Reverse ( ) : void

Reverse waypoints, current waypoint and percentBetweenWaypoints This is used when reach the end, so we don't need handle both logics

Start ( ) : void

Setup initial state

Stop ( ) : void

Stop MovingPlatform

StopOn ( int waypoints ) : void

TODO

Private Methods

Method Description
CalculatePlatformMovement ( float delta ) : Vector3

Calculate how much the platform will move NOTE This can't be called without moving the platform

Ease ( float x ) : float

Ease movement formula TODO use UnityPlatformer.Easing even when some configuration don't make sense...

Method Details

CalculatePassengerMovement() public method

Calculate how much each passenger should move
public CalculatePassengerMovement ( Vector3 velocity ) : void
velocity Vector3
return void

DoAction() public method

Perform an action over MovingPlatform like: Resume, stop, reverse....
public DoAction ( MovingPlatformActions action ) : void
action MovingPlatformActions
return void

IsStopped() public method

Reverse waypoints, current waypoint and percentBetweenWaypoints This is used when reach the end, so we don't need handle both logics
public IsStopped ( ) : bool
return bool

LatePlatformerUpdate() public method

Do nothing
public LatePlatformerUpdate ( float delta ) : void
delta float
return void

MovePassengers() public method

Move passenger
public MovePassengers ( bool beforeMovePlatform ) : void
beforeMovePlatform bool
return void

OnDisable() public method

notify UpdateManager
public OnDisable ( ) : void
return void

OnEnable() public method

notify UpdateManager
public OnEnable ( ) : void
return void

PlatformerUpdate() public method

Get passenger list, pre update, move and post update
public PlatformerUpdate ( float delta ) : void
delta float
return void

Resume() public method

Resume movement with default speed
public Resume ( ) : void
return void

Reverse() public method

Reverse waypoints, current waypoint and percentBetweenWaypoints This is used when reach the end, so we don't need handle both logics
public Reverse ( ) : void
return void

Start() public method

Setup initial state
public Start ( ) : void
return void

Stop() public method

Stop MovingPlatform
public Stop ( ) : void
return void

StopOn() public method

TODO
public StopOn ( int waypoints ) : void
waypoints int
return void

Property Details

disableDownRayCast public property

downcast can move Character in unexpected manners but it's also necessary for one-way-moving-platforms... TODO kill player?
public bool disableDownRayCast
return bool

onReachWaypoint public property

It's called just after select next waypoint and before apply waitTime
public ReachWaypoint onReachWaypoint
return ReachWaypoint

onResume public property

callback call when MovingPlatform is resume
public Action,System onResume
return System.Action

onStop public property

callback call when MovingPlatform is stopped
public Action,System onStop
return System.Action

path public property

Path that MovingPlatform will follow
public Line path
return Line

speed public property

Speed along the path
public float speed
return float

startStopped public property

Initial state stop?
public bool startStopped
return bool