Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.RailPlatform Class Reference

Platform class that locks player to the platform and allows them to control position along the rail. More...

Inheritance diagram for PlatformerPro.RailPlatform:
PlatformerPro.ParentOnStandPlatform PlatformerPro.Platform PlatformerPro.PersistableObject PlatformerPro.PlatformerProMonoBehaviour

Public Member Functions

virtual bool CheckForActivate (Character character, SpecialMovement_Rail railMovement)
 Checks the rail moement to see if we should activate. More...
 
override void UnParent (IMob character)
 Called when the character is unparented from this platform. More...
 
- Public Member Functions inherited from PlatformerPro.ParentOnStandPlatform
override void Parent (IMob character)
 Called when the character is parented to this platform. More...
 
- Public Member Functions inherited from PlatformerPro.Platform
virtual void Activate (IMob mob)
 Activate the platform. More...
 
virtual void Deactivate (IMob mob)
 Deactivate the platform. More...
 
virtual bool IgnoreCollision (Character character, BasicRaycast collider)
 Called to determine if collision should be ignored. Use for one way platforms or z-ordered platforms like those found in loops. More...
 
virtual bool Collide (PlatformCollisionArgs args)
 Called when one of the characters colliders collides with this platform. More...
 
virtual bool SkipMovement (Character character, Movement movement)
 Does this platform want to prevent the given movement from moving. Generally implementations will use the movement.GetType() to restrict specific classes of movement. Only applied when character is parented to the platform. More...
 
- Public Member Functions inherited from PlatformerPro.PersistableObject
void SetPersistenceState (bool state)
 Sets the persistence state. More...
 
void SetPersistenceState (bool state, string extraPersistenceData)
 Sets the persistence state, overriding extra persistence data More...
 
- Public Member Functions inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual void Validate (PlatformerProMonoBehaviour myTarget)
 Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More...
 

Public Attributes

List< Vector2 > waypoints
 The way points. More...
 
float moveSpeed
 Max speed to move towards the next waypoint at. More...
 
float acceleration
 Rate of acceleration up to moveSpeed. More...
 
float deceleration
 Rate of deceleration down to zero. More...
 
float slopeAccelerationBoost
 The slope acceleration. More...
 
RailMoveType moveType
 How do we move around the waypoints? More...
 
bool allowJump
 Can we jump off the rail? More...
 
int requiredActionButton = -1
 Which action button needs to be held to enable movement. Use -1 for none (auto-lock). More...
 
AnimationState idleState = AnimationState.RAIL_IDLE
 State to play when stationary on rail. More...
 
AnimationState movingState = AnimationState.RAIL_MOVE
 State to play when moving along rail. More...
 
int facingDirection = 1
 The facing direction. More...
 
- Public Attributes inherited from PlatformerPro.ParentOnStandPlatform
bool parentOnHeadCollission
 Should we parent when the head collides with this platform (used when you have hang from ceiling). More...
 
- Public Attributes inherited from PlatformerPro.Platform
bool useDefaultPersistence
 Does this Item get persistence defaults form the Game manager? More...
 
- Public Attributes inherited from PlatformerPro.PersistableObject
bool enablePersistence
 Should we enable persistence? More...
 
string guid = System.Guid.NewGuid().ToString()
 Unique ID for this object. You shoulnd't need to edit this, use editor debug mode if you must. More...
 
GameObject target
 GameObject to apply persitence settings to, defaults to self. More...
 
PersistableObjectType persistenceImplementation
 How do we implement the persistence settings. More...
 
bool defaultStateIsDisabled
 If true then the obejct starts disabled. More...
 
string spawnedObjectName
 If this item was spawned then save the name of the prefab here. More...
 

Protected Member Functions

override void PostInit ()
 Init this instance. More...
 
virtual int GetFollowCurveDirection ()
 Gets a value of -1, 1 or 0 based on the user following the curve direction with input. More...
 
override void DoMove ()
 Do the move. More...
 
virtual void NextWaypoint (int direction)
 Update left and right waypoints as well as the has reached end variable. More...
 
- Protected Member Functions inherited from PlatformerPro.ParentOnStandPlatform
override void DoUpdate ()
 Unit update hook. More...
 
override bool CustomCollide (PlatformCollisionArgs args)
 If the collission is a foot try to parent. More...
 
- Protected Member Functions inherited from PlatformerPro.Platform
virtual void OnPlatformActivated (IMob character)
 Raises the activated event. More...
 
virtual void OnPlatformDeactivated (IMob character)
 Raises the deactivated event. More...
 
virtual void OnFired (IMob character)
 Raises the fired event. More...
 
void BaseCollide (PlatformCollisionArgs args)
 Called when one of the characters colliders collides with this platform. This handles basic shared behaviour. If you want to ignore it you can ovverride Collide() instead of CustomCollide(). More...
 
virtual void SavePersistenceData ()
 Gets the extra persistence data which is used to save platform state. NOTE: Generally you should override ExtraPersistenceData to save a different set of data. More...
 
override void ApplyCustomPersistence (PersistableObjectData data)
 Custom persistable implementation. Override to customise. More...
 
virtual void DoDrawGizmos ()
 Draw the base gizmos More...
 
virtual void DoDrawSelectedGizmos ()
 Draw the base gizmos shown when selected. More...
 
virtual void OnConnectedToObject (Object other)
 Called when the connect handle is dragged on to another object. More...
 
- Protected Member Functions inherited from PlatformerPro.PersistableObject
virtual void SetPersistenceDefaults ()
 Sets the persistence defaults. More...
 
virtual void ProcessState ()
 Processes the persisted state. More...
 
virtual void ApplyExtraPersistenceData (PersistableObjectData data)
 Apply any extra data. This differs from custom persistence, as custom persistence must control both data and ctivation state. More...
 

Protected Attributes

float currentSpeed
 CurrentSpeed More...
 
int currentAutoDirection
 Direction we are currently heading. More...
 
int currentWaypointRight = 1
 Index of the current way point to the right of current position. More...
 
int currentWaypointLeft = 0
 Index of the current way point to the left of current position. More...
 
Character character
 Character reference. More...
 
SpecialMovement_Rail railMovement
 Cached rail movement reference. More...
 
int hasReachedEnd = -1
 Tracks if we have reached either end of the rail. -1 start, -1 end, 0 anything else. Starts at -1. More...
 
Transform myTransform
 Cached reference to the transform. More...
 
- Protected Attributes inherited from PlatformerPro.Platform
float friction = -1
 The friction coefficient use -1 for default. More...
 
PlatformActivationType automaticActivation
 How should the platform activate itself? More...
 
PlatformDeactivationType automaticDeactivation
 How should the platform deactivate itself? More...
 
bool conditionsEnableCollisions = true
 Should additional conditions enable or disable collisions. More...
 
CharacterEventArgs characterEventArgs
 A cached character event args that we update so we don't need to allocate. More...
 
AdditionalCondition[] conditions
 Cached list of all additional conditions. More...
 

Static Protected Attributes

const float MaxDistanceForNextWayPoint = 0.05f
 If we are this close to a waypoint we consider ourselves at the waypoint. More...
 
- Static Protected Attributes inherited from PlatformerPro.Platform
static GUIStyle connectionHandleStyle
 The conneciton handle stlye More...
 
static Platform activeConnectHandleDrag
 
static Vector3 currentConnectPosition
 

Properties

int MoveDirection [get]
 Which way are we moving? More...
 
virtual AnimationState AnimationState [get]
 Gets the current animation state. More...
 
- Properties inherited from PlatformerPro.Platform
virtual bool Activated [get, protected set]
 Gets or sets a value indicating whether this PlatformerPro.Platform is activated. More...
 
virtual float Friction [get]
 Gets the friction coefficent for the platform. Returns -1 if the default should be used. More...
 
virtual bool IsMultiplayerReady [get]
 Gets a value indicating whether this platform can handle multiple characters at once. More...
 
virtual PlatformActivationType ForcedActivation [get]
 If this is not NONE then the actiation state will be forced to this value and not editable by user. More...
 
virtual PlatformDeactivationType ForcedDeactivation [get]
 If this is not NONE then the deactiation state will be forced to this value and not editable by user. More...
 
- Properties inherited from PlatformerPro.PersistableObject
virtual string ExtraPersistenceData [get]
 Gets the extra persistence data. More...
 
- Properties inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual string Header [get]
 Gets the header string used to describe the component. More...
 
virtual string DocLink [get]
 Gets a link to documentation site. More...
 
virtual string VideoLink [get]
 Gets a link to a youtube video. More...
 
virtual string Deprecated [get]
 If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More...
 

Additional Inherited Members

- Static Public Attributes inherited from PlatformerPro.Platform
static Color GizmoColor = new Color(0.3f, 0.4f, 1.0f, 1.0f)
 Default color to use when drawing Platform gizmos. More...
 
- Events inherited from PlatformerPro.Platform
System.EventHandler< CharacterEventArgsPlatformActivated
 Occurs when activated. More...
 
System.EventHandler< CharacterEventArgsPlatformDeactivated
 Occurs when deactivated. More...
 
System.EventHandler< CharacterEventArgsFired
 Some platforms have a special kind of action separate to activa or deactivate. For example the spring of a spring baord, or the fall of a decaying platform. This event is sent for those states. More...
 

Detailed Description

Platform class that locks player to the platform and allows them to control position along the rail.

Member Function Documentation

◆ CheckForActivate()

virtual bool PlatformerPro.RailPlatform.CheckForActivate ( Character  character,
SpecialMovement_Rail  railMovement 
)
virtual

Checks the rail moement to see if we should activate.

Parameters
characterCharacter.
railMovementRail movement.

◆ DoMove()

override void PlatformerPro.RailPlatform.DoMove ( )
protectedvirtual

Do the move.

Reimplemented from PlatformerPro.ParentOnStandPlatform.

◆ GetFollowCurveDirection()

virtual int PlatformerPro.RailPlatform.GetFollowCurveDirection ( )
protectedvirtual

Gets a value of -1, 1 or 0 based on the user following the curve direction with input.

Returns
The follow curve direction.

◆ NextWaypoint()

virtual void PlatformerPro.RailPlatform.NextWaypoint ( int  direction)
protectedvirtual

Update left and right waypoints as well as the has reached end variable.

Parameters
directionDirection.

◆ PostInit()

override void PlatformerPro.RailPlatform.PostInit ( )
protectedvirtual

Init this instance.

Reimplemented from PlatformerPro.Platform.

◆ UnParent()

override void PlatformerPro.RailPlatform.UnParent ( IMob  character)
virtual

Called when the character is unparented from this platform.

Reimplemented from PlatformerPro.ParentOnStandPlatform.

Member Data Documentation

◆ acceleration

float PlatformerPro.RailPlatform.acceleration

Rate of acceleration up to moveSpeed.

◆ allowJump

bool PlatformerPro.RailPlatform.allowJump

Can we jump off the rail?

◆ character

Character PlatformerPro.RailPlatform.character
protected

Character reference.

◆ currentAutoDirection

int PlatformerPro.RailPlatform.currentAutoDirection
protected

Direction we are currently heading.

◆ currentSpeed

float PlatformerPro.RailPlatform.currentSpeed
protected

CurrentSpeed

◆ currentWaypointLeft

int PlatformerPro.RailPlatform.currentWaypointLeft = 0
protected

Index of the current way point to the left of current position.

◆ currentWaypointRight

int PlatformerPro.RailPlatform.currentWaypointRight = 1
protected

Index of the current way point to the right of current position.

◆ deceleration

float PlatformerPro.RailPlatform.deceleration

Rate of deceleration down to zero.

◆ facingDirection

int PlatformerPro.RailPlatform.facingDirection = 1

The facing direction.

◆ hasReachedEnd

int PlatformerPro.RailPlatform.hasReachedEnd = -1
protected

Tracks if we have reached either end of the rail. -1 start, -1 end, 0 anything else. Starts at -1.

◆ idleState

AnimationState PlatformerPro.RailPlatform.idleState = AnimationState.RAIL_IDLE

State to play when stationary on rail.

◆ MaxDistanceForNextWayPoint

const float PlatformerPro.RailPlatform.MaxDistanceForNextWayPoint = 0.05f
staticprotected

If we are this close to a waypoint we consider ourselves at the waypoint.

◆ moveSpeed

float PlatformerPro.RailPlatform.moveSpeed

Max speed to move towards the next waypoint at.

◆ moveType

RailMoveType PlatformerPro.RailPlatform.moveType

How do we move around the waypoints?

◆ movingState

AnimationState PlatformerPro.RailPlatform.movingState = AnimationState.RAIL_MOVE

State to play when moving along rail.

◆ myTransform

Transform PlatformerPro.RailPlatform.myTransform
protected

Cached reference to the transform.

◆ railMovement

SpecialMovement_Rail PlatformerPro.RailPlatform.railMovement
protected

Cached rail movement reference.

◆ requiredActionButton

int PlatformerPro.RailPlatform.requiredActionButton = -1

Which action button needs to be held to enable movement. Use -1 for none (auto-lock).

◆ slopeAccelerationBoost

float PlatformerPro.RailPlatform.slopeAccelerationBoost

The slope acceleration.

◆ waypoints

List<Vector2> PlatformerPro.RailPlatform.waypoints

The way points.

Property Documentation

◆ AnimationState

virtual AnimationState PlatformerPro.RailPlatform.AnimationState
get

Gets the current animation state.

◆ MoveDirection

int PlatformerPro.RailPlatform.MoveDirection
getprotected

Which way are we moving?


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