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

A platform defining a set of steps. More...

Inheritance diagram for PlatformerPro.Stairs:
PlatformerPro.Platform PlatformerPro.PersistableObject PlatformerPro.PlatformerProMonoBehaviour

Public Member Functions

override bool IgnoreCollision (Character character, BasicRaycast collider)
 Called to determine if collision should be ignored. More...
 
int GetStepForPosition (Vector2 position)
 Gets the step number for a given world position. More...
 
Vector2 GetPositionForStep (int step)
 Gets the position for the middle top of the given step. Doesn't check step bounds. 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 Collide (PlatformCollisionArgs args)
 Called when one of the characters colliders collides with this platform. More...
 
virtual void Parent (IMob character)
 Called when the character is parented to this platform. More...
 
virtual void UnParent (IMob character)
 Called when the character is unparented from 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...
 

Protected Member Functions

override void PostInit ()
 Init this instance. More...
 
bool ShouldStartDescent (Character character, BasicRaycast collider)
 Should we start descending stairs. More...
 
bool ShouldStartClimb (Character character, BasicRaycast collider)
 Should we start climbing stairs. More...
 
bool ShouldAirMount (Character character, BasicRaycast collider)
 Determines if we should mount the stairs when we fall on them. More...
 
- Protected Member Functions inherited from PlatformerPro.Platform
virtual void OnPlatformActivated (IMob character)
 Raises the activated event. More...
 
virtual void DoUpdate ()
 Add update code here so it isn't triggered during play mode. 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 bool CustomCollide (PlatformCollisionArgs args)
 Called when one of the characters colliders collides with this platform. This should be overriden for platform specific behaviour. 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

int stepCount = 5
 The number of steps that are on these stairs. More...
 
float ignoreColliderDistance = 0.25f
 Ignore the charater unless they are this deep in to the ocllider (stops character climbing the starts of the stairs as if its a slope). More...
 
StairCollisionType topMountType
 
StairCollisionType bottomMountType
 
StairAirType airMountType
 
Vector2 stepSize
 The calculated size of each step More...
 
float stepDirection
 The step direction. We use a float becasue we are frequently using this in multiplication and divison with other floats. More...
 
Vector2 leftPoint
 The leftmost stair point. More...
 
Vector2 rightPoint
 The right most stair point. 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...
 

Properties

Vector2 StepSize [get]
 The size of a step. More...
 
float StepDirection [get]
 Direction of the stair case, 1 means ascending to the right, -1 means ascending to the left. More...
 
int LastStep [get]
 Gets the last step/total number of steps. 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

- 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...
 
- 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...
 
- Static Protected Attributes inherited from PlatformerPro.Platform
static GUIStyle connectionHandleStyle
 The conneciton handle stlye More...
 
static Platform activeConnectHandleDrag
 
static Vector3 currentConnectPosition
 
- 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

A platform defining a set of steps.

Member Function Documentation

◆ GetPositionForStep()

Vector2 PlatformerPro.Stairs.GetPositionForStep ( int  step)

Gets the position for the middle top of the given step. Doesn't check step bounds.

Returns
The position of the step step.
Parameters
stepStep.

◆ GetStepForPosition()

int PlatformerPro.Stairs.GetStepForPosition ( Vector2  position)

Gets the step number for a given world position.

◆ IgnoreCollision()

override bool PlatformerPro.Stairs.IgnoreCollision ( Character  character,
BasicRaycast  collider 
)
virtual

Called to determine if collision should be ignored.

Returns
true

false

Parameters
characterCharacter.
colliderCollider.

Reimplemented from PlatformerPro.Platform.

◆ PostInit()

override void PlatformerPro.Stairs.PostInit ( )
protectedvirtual

Init this instance.

Reimplemented from PlatformerPro.Platform.

◆ ShouldAirMount()

bool PlatformerPro.Stairs.ShouldAirMount ( Character  character,
BasicRaycast  collider 
)
protected

Determines if we should mount the stairs when we fall on them.

Returns
true, if we should mount stairs.
Parameters
characterCharacter.
colliderCollider.

◆ ShouldStartClimb()

bool PlatformerPro.Stairs.ShouldStartClimb ( Character  character,
BasicRaycast  collider 
)
protected

Should we start climbing stairs.

Returns
true, if we should start climbing, false otherwise.
Parameters
characterCharacter.
colliderCollider.

◆ ShouldStartDescent()

bool PlatformerPro.Stairs.ShouldStartDescent ( Character  character,
BasicRaycast  collider 
)
protected

Should we start descending stairs.

Returns
true, if we should start descending, false otherwise.
Parameters
characterCharacter.
colliderCollider.

Member Data Documentation

◆ airMountType

StairAirType PlatformerPro.Stairs.airMountType
protected

◆ bottomMountType

StairCollisionType PlatformerPro.Stairs.bottomMountType
protected

summary> How we determine if we should mount stairs when in the air.

◆ ignoreColliderDistance

float PlatformerPro.Stairs.ignoreColliderDistance = 0.25f
protected

Ignore the charater unless they are this deep in to the ocllider (stops character climbing the starts of the stairs as if its a slope).

summary> How we determine if we should start descending the stairs.

◆ leftPoint

Vector2 PlatformerPro.Stairs.leftPoint
protected

The leftmost stair point.

◆ rightPoint

Vector2 PlatformerPro.Stairs.rightPoint
protected

The right most stair point.

◆ stepCount

int PlatformerPro.Stairs.stepCount = 5
protected

The number of steps that are on these stairs.

◆ stepDirection

float PlatformerPro.Stairs.stepDirection
protected

The step direction. We use a float becasue we are frequently using this in multiplication and divison with other floats.

◆ stepSize

Vector2 PlatformerPro.Stairs.stepSize
protected

The calculated size of each step

◆ topMountType

StairCollisionType PlatformerPro.Stairs.topMountType
protected

summary> How we determine if we should start ascending the stairs.

Property Documentation

◆ LastStep

int PlatformerPro.Stairs.LastStep
get

Gets the last step/total number of steps.

The last step.

◆ StepDirection

float PlatformerPro.Stairs.StepDirection
get

Direction of the stair case, 1 means ascending to the right, -1 means ascending to the left.

◆ StepSize

Vector2 PlatformerPro.Stairs.StepSize
get

The size of a step.


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