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

Base class from which platforms should extend. More...

Inheritance diagram for PlatformerPro.Platform:
PlatformerPro.PersistableObject PlatformerPro.PlatformerProMonoBehaviour PlatformerPro.ConveyerPlatform PlatformerPro.CrumblingPlatform PlatformerPro.DepthPlatform PlatformerPro.DepthSwitchPlatform PlatformerPro.DestroyOnHeadbutt PlatformerPro.DestructiblePlatform PlatformerPro.Door PlatformerPro.FallingPlatform PlatformerPro.HorizontalSpringboardPlatform PlatformerPro.IgnoreColliderPlatform PlatformerPro.ParentOnStandPlatform PlatformerPro.PlatformLogger PlatformerPro.SpawnOnHeadbutt PlatformerPro.SpecialMovementPlatform PlatformerPro.SpringboardPlatform PlatformerPro.Stairs PlatformerPro.StompOnHead PlatformerPro.TrapdoorPlatform PlatformerPro.TriggerPlatform

Public Member Functions

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 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...
 

Public Attributes

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

static Color GizmoColor = new Color(0.3f, 0.4f, 1.0f, 1.0f)
 Default color to use when drawing Platform gizmos. More...
 

Protected Member Functions

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...
 
override void PostInit ()
 Init this instance. 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

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

static GUIStyle connectionHandleStyle
 The conneciton handle stlye More...
 
static Platform activeConnectHandleDrag
 
static Vector3 currentConnectPosition
 

Properties

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...
 

Events

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

Base class from which platforms should extend.

Member Function Documentation

◆ Activate()

virtual void PlatformerPro.Platform.Activate ( IMob  mob)
virtual

Activate the platform.

Parameters
mobMob.

Reimplemented in PlatformerPro.FallingPlatform.

◆ ApplyCustomPersistence()

override void PlatformerPro.Platform.ApplyCustomPersistence ( PersistableObjectData  data)
protectedvirtual

Custom persistable implementation. Override to customise.

Parameters
dataData.

Reimplemented from PlatformerPro.PersistableObject.

Reimplemented in PlatformerPro.SpawnOnHeadbutt.

◆ BaseCollide()

void PlatformerPro.Platform.BaseCollide ( PlatformCollisionArgs  args)
protected

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().

Parameters
PlatformCollisionArgsArguments describing a platform collision.

◆ Collide()

virtual bool PlatformerPro.Platform.Collide ( PlatformCollisionArgs  args)
virtual

Called when one of the characters colliders collides with this platform.

Parameters
PlatformCollisionArgsArguments describing a platform collision.
Returns
true if character should be parented to this platform, otherwise false.

Reimplemented in PlatformerPro.PlatformLogger, and PlatformerPro.StompOnHead.

◆ CustomCollide()

virtual bool PlatformerPro.Platform.CustomCollide ( PlatformCollisionArgs  args)
protectedvirtual

Called when one of the characters colliders collides with this platform. This should be overriden for platform specific behaviour.

Parameters
PlatformCollisionArgsArguments describing a platform collision.
Returns
true if character should be parented to this platform, otherwise false.

Reimplemented in PlatformerPro.TriggerPlatform, PlatformerPro.SpringboardPlatform, PlatformerPro.SpawnOnHeadbutt, PlatformerPro.ParentOnStandPlatform, PlatformerPro.HorizontalSpringboardPlatform, PlatformerPro.FallingPlatform, PlatformerPro.EnterableDoor, PlatformerPro.DestroyOnStandPlatform, PlatformerPro.DestroyOnHeadbutt, PlatformerPro.DepthSwitchPlatform, PlatformerPro.CrumblingPlatform, and PlatformerPro.ConveyerPlatform.

◆ Deactivate()

virtual void PlatformerPro.Platform.Deactivate ( IMob  mob)
virtual

Deactivate the platform.

Parameters
mobMob.

◆ DoDrawGizmos()

virtual void PlatformerPro.Platform.DoDrawGizmos ( )
protectedvirtual

Draw the base gizmos

Reimplemented in PlatformerPro.BackAndForthPlatform.

◆ DoDrawSelectedGizmos()

virtual void PlatformerPro.Platform.DoDrawSelectedGizmos ( )
protectedvirtual

Draw the base gizmos shown when selected.

◆ DoUpdate()

virtual void PlatformerPro.Platform.DoUpdate ( )
protectedvirtual

Add update code here so it isn't triggered during play mode.

Reimplemented in PlatformerPro.UpAndDownPlatformWithReturn, and PlatformerPro.ParentOnStandPlatform.

◆ IgnoreCollision()

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

Called to determine if collision should be ignored. Use for one way platforms or z-ordered platforms like those found in loops.

Returns
true, if Collision should be ignored, false otherwise.
Parameters
characterCharacter.
colliderCollider.

Reimplemented in PlatformerPro.TrapdoorPlatform, PlatformerPro.Stairs, PlatformerPro.IgnoreColliderPlatform, PlatformerPro.Door, and PlatformerPro.DepthPlatform.

◆ OnConnectedToObject()

virtual void PlatformerPro.Platform.OnConnectedToObject ( Object  other)
protectedvirtual

Called when the connect handle is dragged on to another object.

Parameters
other

◆ OnFired()

virtual void PlatformerPro.Platform.OnFired ( IMob  character)
protectedvirtual

Raises the fired event.

Parameters
characterCharacter causing platform to fire, can be null.

◆ OnPlatformActivated()

virtual void PlatformerPro.Platform.OnPlatformActivated ( IMob  character)
protectedvirtual

Raises the activated event.

Parameters
characterCharacter causing activation, can be null.

◆ OnPlatformDeactivated()

virtual void PlatformerPro.Platform.OnPlatformDeactivated ( IMob  character)
protectedvirtual

Raises the deactivated event.

Parameters
characterCharacter causing deactivation, can be null.

◆ Parent()

virtual void PlatformerPro.Platform.Parent ( IMob  character)
virtual

Called when the character is parented to this platform.

Parameters
characterCharacter being parented.

Reimplemented in PlatformerPro.ParentOnStandPlatform, PlatformerPro.FallingPlatform, PlatformerPro.DestroyOnStandPlatform, PlatformerPro.DamageAfterTimePlatform, and PlatformerPro.CrumblingPlatform.

◆ PostInit()

◆ SavePersistenceData()

virtual void PlatformerPro.Platform.SavePersistenceData ( )
protectedvirtual

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.

◆ SkipMovement()

virtual bool PlatformerPro.Platform.SkipMovement ( Character  character,
Movement  movement 
)
virtual

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.

Returns
true, if movement should be skipped, false otherwise.
Parameters
characterCharacter being checked.
movementMovement being checked.

Reimplemented in PlatformerPro.SpringboardPlatform, PlatformerPro.RotatingPlatform, PlatformerPro.LoopPlatform, PlatformerPro.HorizontalSpringboardPlatform, and PlatformerPro.ConveyerPlatform.

◆ UnParent()

virtual void PlatformerPro.Platform.UnParent ( IMob  character)
virtual

Member Data Documentation

◆ activeConnectHandleDrag

Platform PlatformerPro.Platform.activeConnectHandleDrag
staticprotected

◆ automaticActivation

PlatformActivationType PlatformerPro.Platform.automaticActivation
protected

How should the platform activate itself?

◆ automaticDeactivation

PlatformDeactivationType PlatformerPro.Platform.automaticDeactivation
protected

How should the platform deactivate itself?

◆ characterEventArgs

CharacterEventArgs PlatformerPro.Platform.characterEventArgs
protected

A cached character event args that we update so we don't need to allocate.

◆ conditions

AdditionalCondition [] PlatformerPro.Platform.conditions
protected

Cached list of all additional conditions.

◆ conditionsEnableCollisions

bool PlatformerPro.Platform.conditionsEnableCollisions = true
protected

Should additional conditions enable or disable collisions.

◆ connectionHandleStyle

GUIStyle PlatformerPro.Platform.connectionHandleStyle
staticprotected

The conneciton handle stlye

◆ currentConnectPosition

Vector3 PlatformerPro.Platform.currentConnectPosition
staticprotected

◆ friction

float PlatformerPro.Platform.friction = -1
protected

The friction coefficient use -1 for default.

◆ GizmoColor

Color PlatformerPro.Platform.GizmoColor = new Color(0.3f, 0.4f, 1.0f, 1.0f)
static

Default color to use when drawing Platform gizmos.

◆ useDefaultPersistence

bool PlatformerPro.Platform.useDefaultPersistence

Does this Item get persistence defaults form the Game manager?

Property Documentation

◆ Activated

virtual bool PlatformerPro.Platform.Activated
getprotected set

Gets or sets a value indicating whether this PlatformerPro.Platform is activated.

◆ ForcedActivation

virtual PlatformActivationType PlatformerPro.Platform.ForcedActivation
get

If this is not NONE then the actiation state will be forced to this value and not editable by user.

◆ ForcedDeactivation

virtual PlatformDeactivationType PlatformerPro.Platform.ForcedDeactivation
get

If this is not NONE then the deactiation state will be forced to this value and not editable by user.

◆ Friction

virtual float PlatformerPro.Platform.Friction
get

Gets the friction coefficent for the platform. Returns -1 if the default should be used.

◆ IsMultiplayerReady

virtual bool PlatformerPro.Platform.IsMultiplayerReady
get

Gets a value indicating whether this platform can handle multiple characters at once.

true if this instance is multiplayer ready; otherwise, false.

Event Documentation

◆ Fired

System.EventHandler<CharacterEventArgs> PlatformerPro.Platform.Fired

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.

◆ PlatformActivated

System.EventHandler<CharacterEventArgs> PlatformerPro.Platform.PlatformActivated

Occurs when activated.

◆ PlatformDeactivated

System.EventHandler<CharacterEventArgs> PlatformerPro.Platform.PlatformDeactivated

Occurs when deactivated.


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