platformer
|
Moving Platform Tile More...
Classes | |
struct | PassengerMovement |
Struct to store information about passenger movement More... | |
Public Member Functions | |
delegate void | PassengerEvent (Transform transform) |
callback call when passenter enter/leave More... | |
delegate void | WaypointEvent (int index) |
callback call when reach any waypoint More... | |
override void | Start () |
Setup initial state More... | |
void | Stop () |
Stop MovingPlatform More... | |
void | StopOn (int waypoints) |
TODO More... | |
void | Resume () |
Resume movement with default speed More... | |
void | Reverse () |
Reverse waypoints, current waypoint and percentBetweenWaypoints This is used when reach the end, so we don't need handle both logics More... | |
bool | IsStopped () |
Reverse waypoints, current waypoint and percentBetweenWaypoints This is used when reach the end, so we don't need handle both logics More... | |
virtual void | LatePlatformerUpdate (float delta) |
Do nothing More... | |
void | PlatformerUpdate (float delta) |
Get passenger list, pre update, move and post update More... | |
void | DoAction (MovingPlatformActions action) |
Perform an action over MovingPlatform like: Resume, stop, reverse.... More... | |
override void | OnEnable () |
notify UpdateManager More... | |
![]() | |
void | UpdateInnerBounds () |
Recalculate shrinked the bounds More... | |
void | UpdateRaycastOrigins () |
Recalculate raycastOrigins More... | |
void | CalculateRaySpacing () |
Recalculate distance between rays (horizontalRaySpacing & verticalRaySpacing) More... | |
RaycastHit2D | Raycast (Vector2 origin, Vector2 direction, float rayLength, int mask, Color? color=null) |
Call Physics2D.Raycast and Draw the ray to debug More... | |
RaycastHit2D | VerticalRay (float directionY, int index, float rayLength, ref Vector3 velocity, Color? c=null) |
Return RaycastHit2D of Raycasting at given index More... | |
RaycastHit2D | FeetRay (float rayLength, LayerMask mask) |
Return RaycastHit2D of Raycasting at bottom center. More... | |
delegate void | RayItr (ref RaycastHit2D hit, ref Vector3 velocity, int dir, int idx) |
Callback for iterate rays More... | |
void | ForeachRightRay (float rayLength, ref Vector3 velocity, RayItr itr) |
Iterate over all right/horizontal rays More... | |
void | ForeachLeftRay (float rayLength, ref Vector3 velocity, RayItr itr) |
Iterate over all left/horizontal rays More... | |
void | ForeachHeadRay (float rayLength, ref Vector3 velocity, RayItr itr, bool checkGravitySwap=true) |
Iterate over all head/vertical rays More... | |
void | ForeachFeetRay (float rayLength, ref Vector3 velocity, RayItr itr, bool checkGravitySwap=true) |
Iterate over all feet/vertical rays More... | |
Vector2 | GetDownVector () |
Return gravity aware down Vector2 More... | |
Vector3 | GetBottomLeft () |
Return gravity aware bottom left More... | |
Vector3 | GetBottomRight () |
Return gravity aware bottom right More... | |
RaycastHit2D | LeftFeetRay (float rayLength, Vector3 velocity) |
Return RaycastHit2D of Raycasting at bottom left. More... | |
RaycastHit2D | RightFeetRay (float rayLength, Vector3 velocity) |
Return RaycastHit2D of Raycasting at bottom right. More... | |
Public Attributes | |
LayerMask | passengerMask |
Mask of things that can be a passanger More... | |
Line | path |
Path that MovingPlatform will follow More... | |
float | speed = 2 |
Speed along the path More... | |
bool | cyclic = false |
true: MovingPlatform will be looping false: MovingPlatform will go back and forth More... | |
float | waitTime = 0 |
Delay after each waypoint More... | |
float | easeAmount = 0 |
Ease movement More... | |
bool | disableDownRayCast = false |
downcast can move Character in unexpected manners but it's also necessary for one-way-moving-platforms... TODO kill player? More... | |
bool | startStopped = false |
Initial state stop? More... | |
WaypointEvent | onWaypointEvent |
Called just after select next waypoint and before apply waitTime More... | |
PassengerEvent | onEnterPassenger |
Called when a Character start being a passenger More... | |
PassengerEvent | onExitPassenger |
Called when a Character is not longer a passenger More... | |
Action | onStop |
callback call when MovingPlatform is stopped More... | |
Action | onResume |
callback call when MovingPlatform is resume More... | |
Vector3 [] | globalWaypoints |
waypoints list taken from path More... | |
![]() | |
bool | debug = false |
Enable drawing debug information, this has performance impact More... | |
LayerMask | collisionMask |
Static geometry mask More... | |
float | minDistanceToEnv = 0.1f |
How far from then env the Character must be. More... | |
float | skinWidth = 0.2f |
Defines how far in from the edges of the collider rays are we going to cast from. More... | |
int | horizontalRayCount = 4 |
How many rays to check horizontal collisions More... | |
int | verticalRayCount = 4 |
How many rays to check vertical collisions More... | |
float | height |
Collider real height More... | |
Vector3 | localCenter |
Collider center in local space More... | |
Protected Attributes | |
int | fromWaypointIndex |
current waypoint index More... | |
float | percentBetweenWaypoints |
current percentage (0-1) between previous/next waypoints More... | |
float | nextMoveTime |
time since last waypoint start, used to calculate (waitTime) delay More... | |
List< PassengerMovement > | passengerMovement |
List of passengers to move More... | |
List< PassengerMovement > | pPassengerMovement |
List of previous passengers More... | |
HashSet< Transform > | prevPassengers = null |
List of passengers to moved More... | |
float | currentSpeed |
Current speed More... | |
Vector3 | lastPosition |
Last position More... | |
Additional Inherited Members | |
![]() | |
Vector3 | center [get] |
Collider center in world space More... | |
Moving Platform Tile
|
inline |
Perform an action over MovingPlatform like: Resume, stop, reverse....
|
inline |
Reverse waypoints, current waypoint and percentBetweenWaypoints This is used when reach the end, so we don't need handle both logics
|
inlinevirtual |
Do nothing
Implements UnityPlatformer.IUpdateEntity.
|
inlinevirtual |
notify UpdateManager
Reimplemented from UnityPlatformer.RaycastController.
delegate void UnityPlatformer.MovingPlatform.PassengerEvent | ( | Transform | transform | ) |
callback call when passenter enter/leave
|
inline |
Get passenger list, pre update, move and post update
Implements UnityPlatformer.IUpdateEntity.
|
inline |
Resume movement with default speed
|
inline |
Reverse waypoints, current waypoint and percentBetweenWaypoints This is used when reach the end, so we don't need handle both logics
|
inlinevirtual |
Setup initial state
Reimplemented from UnityPlatformer.RaycastController.
|
inline |
Stop MovingPlatform
|
inline |
TODO
delegate void UnityPlatformer.MovingPlatform.WaypointEvent | ( | int | index | ) |
callback call when reach any waypoint
|
protected |
Current speed
bool UnityPlatformer.MovingPlatform.cyclic = false |
true: MovingPlatform will be looping false: MovingPlatform will go back and forth
bool UnityPlatformer.MovingPlatform.disableDownRayCast = false |
downcast can move Character in unexpected manners but it's also necessary for one-way-moving-platforms... TODO kill player?
float UnityPlatformer.MovingPlatform.easeAmount = 0 |
Ease movement
|
protected |
current waypoint index
Vector3 [] UnityPlatformer.MovingPlatform.globalWaypoints |
waypoints list taken from path
|
protected |
Last position
|
protected |
time since last waypoint start, used to calculate (waitTime) delay
PassengerEvent UnityPlatformer.MovingPlatform.onEnterPassenger |
Called when a Character start being a passenger
PassengerEvent UnityPlatformer.MovingPlatform.onExitPassenger |
Called when a Character is not longer a passenger
Action UnityPlatformer.MovingPlatform.onResume |
callback call when MovingPlatform is resume
Action UnityPlatformer.MovingPlatform.onStop |
callback call when MovingPlatform is stopped
WaypointEvent UnityPlatformer.MovingPlatform.onWaypointEvent |
Called just after select next waypoint and before apply waitTime
LayerMask UnityPlatformer.MovingPlatform.passengerMask |
Mask of things that can be a passanger
|
protected |
List of passengers to move
Line UnityPlatformer.MovingPlatform.path |
Path that MovingPlatform will follow
|
protected |
current percentage (0-1) between previous/next waypoints
|
protected |
List of previous passengers
|
protected |
List of passengers to moved
float UnityPlatformer.MovingPlatform.speed = 2 |
Speed along the path
bool UnityPlatformer.MovingPlatform.startStopped = false |
Initial state stop?
float UnityPlatformer.MovingPlatform.waitTime = 0 |
Delay after each waypoint