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

The root class for a character. This class ties together movement, animation, and other behaviours. More...

Inheritance diagram for PlatformerPro.Character:
PlatformerPro.PlatformerProMonoBehaviour PlatformerPro.IMob

Public Member Functions

delegate void NamedPropertySetter (object value)
 Delegate for setting a named property. More...
 
virtual void OnChangeAnimationState ()
 Raises the change animation state event. This version is public and it just triggers a resend not a change. More...
 
virtual void Translate (float x, float y, bool applyTransformsInWorldSpace)
 Translate the character by the supplied amount. More...
 
virtual void AddVelocity (float x, float y, bool velocityIsInWorldSpace)
 Adds velocity. More...
 
virtual void SetVelocityX (float x)
 Sets X velocity. More...
 
virtual void SetVelocityY (float y)
 Sets Y velocity. More...
 
virtual void DoBaseCollisionsForRaycastType (RaycastType type)
 Executes base collisions for a given raycast collider type. Used by movements that require collision data. More...
 
virtual RaycastHit2D GetClosestCollision (int i)
 Gets the closest collision for the collider from Colliders at the index i. Note this is generally the collissions from the previous frame when called by a movement during a transition check. More...
 
virtual Vector2 ApplyBaseCollisionsForRaycastType (RaycastType type)
 Applies the base collisions for the given raycast collider type. More...
 
virtual void ForceAnimation (AnimationState state, float minimumTime)
 Overrides the animation for the given amount of time. More...
 
virtual void AddAnimationOverride (string overrideState)
 Adds an animation override. NOTE: Currently only one override is supported at a time. Note overrides are used to refer to an animator or layer override (depending on animation type) not forcing the override of a single animation which is done with ForceAnimation(). More...
 
virtual void RemoveAnimationOverride (string overrideState)
 Removes an animation override. NOTE: Currently only one override is supported at a time. More...
 
virtual void Damage (DamageInfo info)
 Damages the character which typically triggers some kind of damage animation. More...
 
virtual void Kill (DamageInfo info)
 Kill the character which typically triggers some kind of death animation. More...
 
virtual void Respawn (RespawnPoint r, int facingDirection)
 Respawn the character. Called by LevelManager. You generally wont call this directly. Note: this method is used to set a characters facing direction during respawn and it is NOT about where the character spawns. If you want to respawn your character at a specific respawn point you should use LevelManager.Respawn(Character character, string respawnPoint) More...
 
virtual void Respawn ()
 Respawn the character. Called by LevelManager.You generally wont call this directly. More...
 
virtual void AboutToExitScene (string newSceneName)
 Called by something that will load a new level (without killing character). More...
 
virtual void FinishedAttack (string name)
 Indicate current attack is finished. More...
 
virtual void HitEnemy (IMob enemy, DamageInfo info)
 Called when the character hits an enemy. More...
 
virtual void SetTaggedProperty (string name, object value)
 Sets the named property across all applicable movements. More...
 
virtual void SetTaggedProperty (string name, object value, List< System.Type > excludedTypes)
 Sets the named property across all applicable movements. More...
 
virtual void AddToTaggedProperty (string name, float value)
 Adds to the named property across all applicable movements. More...
 
virtual void AddToTaggedProperty (string name, float value, List< System.Type > excludedTypes)
 Adds to the named property across all applicable movements. More...
 
virtual void MultiplyTaggedProperty (string name, float value)
 Multiplies the named property across all applicable movements. More...
 
virtual void MultiplyTaggedProperty (string name, float value, List< System.Type > excludedTypes)
 Multiplies the named property across all applicable movements. More...
 
virtual bool IsColliderIgnored (Collider2D collider)
 Check if a given collider should be ignored in collisions. More...
 
virtual void AddIgnoredCollider (Collider2D collider)
 Adds a collider to the list of ignored colliders. More...
 
virtual void RemoveIgnoredCollider (Collider2D collider)
 Removes a collider from the list of ignored colliders. More...
 
virtual void UpdateCurrentWall ()
 
- 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

float feetLookAhead = DefaultFeetLookAhead
 How much extra we cast beyond the collider length when checking feet colliders. We do this so we can (for example) detect a landing state. More...
 
float sideLookAhead = DefaultSideLookAhead
 How much extra we cast beyond the collider length when checking side colliders. We do this so we can (for example) detect a wall. More...
 
float groundedLookAhead = DefaultGroundedLookAhead
 How much extra we cast beyond the collider length when checking feet colliders. We do this so we can (for example) detect a landing state. More...
 
bool snapToGroundOnSlopesOnly = true
 If true snap to ground will only apply on slopes. More...
 
LayerMask layerMask = 1
 All layers that we collide with. Note that just because something is in this group it doesn't mean we do anything about collisions with it. For example this mask includes layers like ladders and triggers which are ignored when responding to collisions. More...
 
LayerMask geometryLayerMask = 1
 The layers that are considered when working out collisions. i.e. the things we can't move through. Layers in this mask must appear in the layerMask. More...
 
LayerMask passthroughLayerMask
 The layers that the character can walk on top of but can passthrough in other directions. More...
 
float fallSpeedForIgnoreHeadCollisions = DefaultFallSpeedForIgnoreHeadCollisions
 Usually set this very low as it gives smoother movement while falling. Can be an issue if you have platforms that move faster downwards than this speed. More...
 
float timeForFallState = 0.1f
 How long do we need to wait before we change the state to falling. This stops minor ground preturbations causing us to trigger the fall animation. More...
 
float terminalVelocity = DefaultTerminalVelocity
 Maximum fall speed (note that any individual movement may override this if it wants to). More...
 
bool calculateSlopes = true
 Should we Calcualte slope angles for use by movements? More...
 
bool rotateToSlopes = false
 Should we allow the character to walk on slopes? More...
 
float maxSlopeRotation = DefaultMaxSlopeRotation
 How far can the character rotate in degrees. More...
 
float rotationSpeed = DefaultRotationSpeed
 How fast the character rotates to match a slope. Measured in degrees per second. More...
 
float upSlopeDeceleration = 0
 Effect of walking up a slope on base max speed. 0 = none, 1 = reduce speed by sine of angle. More...
 
float downSlopeAcceleration = 0
 Effect of walking down a slope on base max speed. 0 = none, 1 = increase speed by sine of angle. More...
 
float sideAngle = DefaultSideAngle
 The minimum angle at which a wall needs to be at for it to be considered a "side". More...
 
float groundedLeeway = DefaultGroundedLeeway
 How long after leaving the ground are we still considered grounded? More...
 
float passthroughLeeway = DefaultPassthroughLeeway
 At what point will a passthrough collider consider itself groudned. Too small and you fall through platforms. Too large and you snap oddly. Usually the default is okay unless you change gravity dramatically. More...
 
float minFastFallPassthroughTime = DefaultMinFastFallPassthroughTime
 When we fall fast we need to consider passthroughs that we fell past but should have snapped to. However at the very peak of a jump this can cause us to snap oddly. This constant stops that happening by ignoring fall times smaller than this. More...
 
bool switchCollidersOnDirectionChange
 Should we switch left and right colliders when the character changes direction (used for asymmetric characters). More...
 
CharacterRotationType characterRotationType
 The type of slope rotation. More...
 
BasicRaycast[] feetColliders
 The feet colliders. More...
 
BasicRaycast[] leftColliders
 The left side colliders. More...
 
BasicRaycast[] rightColliders
 The right side colliders. More...
 
BasicRaycast[] headColliders
 The head colliders. More...
 

Static Public Attributes

const float DefaultFeetLookAhead = 0.2f
 The default feet look ahead. More...
 
const float DefaultGroundedLookAhead = 0.05f
 The default grounded look ahead. More...
 
const float DefaultGroundedLeeway = 0.1f
 The default time after leaving ground for which the character is still conisdered to be on the ground. More...
 
const float DefaultSideLookAhead = 0.1f
 The default side look ahead. More...
 
const float DefaultPassthroughLeeway = -0.1f
 Deafult passthrough leeway. More...
 
const float DefaultMinFastFallPassthroughTime = 0.5f
 Deafult min ast fall time leeway. More...
 
const float DefaultFallSpeedForIgnoreHeadCollisions = 0.2f
 The default fall speed at which head collisions are ignored. More...
 
const float DefaultTerminalVelocity = -15.0f
 Defauly terminal velocity More...
 
const float DefaultMaxSlopeRotation = 50
 The default max slope rotation. More...
 
const float DefaultRotationSpeed = 180
 The default rotation speed. More...
 
const float DefaultSideAngle = 50
 The default side angle. More...
 

Protected Member Functions

virtual void OnChangeAnimationState (AnimationState state, AnimationState previousState)
 Raises the change animation state event. More...
 
virtual void OnChangeAnimationState (AnimationState state, AnimationState previousState, int priority)
 Raises the change animation state event. More...
 
virtual void OnSceneWillExit (string newSceneName)
 Raises the scene will exit event. More...
 
virtual void OnRespawned ()
 Raises the respawned event. More...
 
virtual void OnAttackStarted ()
 Raises the attack started event. More...
 
virtual void OnAttackFinished (string name)
 Raises the attack finished event. More...
 
virtual void OnAttackCausedDamage (IMob enemy, DamageInfo info)
 Raises the attack caused damage event. More...
 
virtual void Init ()
 Set up the character More...
 
virtual void SetGrounded ()
 Sets the grounded state by checking feet colliders. More...
 
virtual void TransitionMovementControl ()
 Pass control to the movement most suitable for the current state. More...
 
virtual void DoBaseCollisions (RaycastType typeMask)
 Does the base collisions. More...
 
virtual void CheckForLadder ()
 Checks if we collided with a ladder. More...
 
virtual void DoRotation ()
 Rotate towards the target rotation. More...
 
virtual void CalculateTargetRotation ()
 Use the feet colliders to determine the target rotation. More...
 
virtual void UpdateClosestColliders (RaycastType typeMask)
 Updates the closest colliders array for the given type mask, leaves other types alone. More...
 
virtual void SwitchColliders ()
 Switches left and right collider direction and flips position of all colliders about y axis. More...
 
virtual void CreateNamedPropertiesDictionary ()
 Creates the dictionary used for apply named proeprty changes. More...
 

Protected Attributes

bool detectLaddersByTag
 Should we use a tag to detect ladders, default will use layer. More...
 
string ladderLayerOrTagName
 Layers or tag name used for ladder detection. More...
 
Input input
 Cached copy of the input. More...
 
bool detectAllWalls
 Detect all walls for use by wall movements? More...
 
bool detectWallsByTag
 Detect walls by tag or layer? More...
 
string wallLayerOrTagName
 Layer or tag name for wall detection. More...
 
Transform myTransform
 Cached copy of the characters transform. More...
 
BaseCollisions baseMovement
 Cached reference to the base movement. More...
 
Movement[] movements
 Cached references to all the movements. More...
 
int activeMovement
 The index of the currently active movement in the movements array. More...
 
int activeAttack
 The active attack. More...
 
int defaultGroundMovement
 The index of the default ground movement in the movements array. More...
 
int defaultAirMovement
 The index of the default air movement in the movements array. More...
 
int defaultLadderMovement
 The index of the default ladder movement in the movements array. -1 for no ladder movement. More...
 
int defaultWallMovement
 The index of the default wall movement in the movements array. -1 for no wall movement. More...
 
int defaultDamageMovement
 The index of the default damage movement in the movements array. -1 for no damage movement. More...
 
int defaultDeathMovement
 The index of the default death movement in the movements array. -1 for no death movement. More...
 
int defaultAttackMovement
 The index of the default attack movement. More...
 
Gravity gravity
 The class that does gravity movement. More...
 
Collider2D currentLadder
 The current ladder collider or null if we don't have a ladder. More...
 
Collider2D currentWall
 The current wall collider or null if we don't have a wall. More...
 
int currentWallCollider
 The current wall collider direction. 1 for right, -1 for left, 0 for none. More...
 
AnimationState animationState
 The caaracters current animation state. More...
 
Platform parentPlatform
 The parent platform. More...
 
Transform parentTransform
 The transform of th parent platform. More...
 
RaycastType parentRaycastType
 Tracks the raycast type we are using for parent calculation. More...
 
BasicRaycast[] colliders
 Cached reference to all colliders. Some funciton expect this to be ordered with feet colliders left to right at the start. More...
 
int[] closestColliders
 Keeps track of the closest collisions. More...
 
float slope
 If slopes are on this is the rotation we are rotating towards. More...
 
int rotationPoint
 Position of the feet collider in the feet colliders array that we should rotate around. More...
 
int animationPriority
 Current animations animation priority. More...
 
string overrideState
 Current animation override. More...
 
AnimationState forcedAnimationState
 The forced animation state. More...
 
float forcedAnimationTime
 The time remaining to play the forced animation. More...
 
AnimationEventArgs animationEventArgs
 A cached animation event args that we update so we don't need to allocate. More...
 
AttackEventArgs attackEventArgs
 The cached attack event args. More...
 
ExtraDamageInfoEventArgs damageEventArgs
 The cached damage event args. More...
 
float ignoredSlope
 The angle of the ignored slope. More...
 
int currentFacingDirection
 The direction currently faced. Used for switch collider calculations. More...
 
bool grounded
 Local copy of grounded state. More...
 
List< BasicRaycastcollidersToUseForWallCling
 A list of colliders that can be used for wall cling (i.e. only those high enough). More...
 
int ladderLayerNumber = -1
 Cached conversion of ladder layer to layer int. More...
 
int wallLayerNumber = -1
 Cached conversion of wall layer to layer int. More...
 
float previousRotation
 The previous frames target rotation. More...
 
int minimumWallColliders
 The minimum required colliders from the various Wall movements. More...
 
RaycastHit2D EmptyRaycastHit = new RaycastHit2D()
 Cached empty ray cast hit. More...
 
Dictionary< string, List< System.Reflection.FieldInfo > > namedProperties
 Dictionary of names properties to field info. More...
 
HashSet< Collider2D > ignoredColliders
 A list of colliders to ingore during collisions. More...
 
DisabledInput disabledInput
 Reference to the disabled input. Used when InputEnabled is set to false. More...
 
Input cachedInput
 Cached input to the main input used when re-enabling input. More...
 

Properties

virtual CharacterHealth CharacterHealth [get, protected set]
 Gets CharacterHealth for this Character. Can be null if Character does not have a CharacterHealth. More...
 
virtual ItemManager ItemManager [get, protected set]
 Gets ItemManager for this Character. Can be null if Character does not have an ItemManager. More...
 
virtual PowerUpManager PowerUpManager [get, protected set]
 Gets PowerUpManager for this Character. Can be null if Character does not have a PowerUpManager. More...
 
virtual Inventory Inventory [get, protected set]
 Gets Inventory for this Character. Can be null if Character does not have an Inventory. More...
 
virtual EquipmentManager EquipmentManager [get, protected set]
 Gets EquipmentManager for this Character. Can be null if Character does not have an EquipmentManager. More...
 
virtual Breath Breath [get, protected set]
 Gets breath for this Character. Can be null if Character does not have Breath. More...
 
virtual int PlayerId [get, set]
 Stores the player that is asociated with this Character. More...
 
virtual Transform Transform [get]
 Gets cache copy of the transform. More...
 
virtual BasicRaycast[] Colliders [get, set]
 Gets or sets the colliders. More...
 
virtual RaycastHit2D[][] CurrentCollisions [get, protected set]
 Gets the current collisions. More...
 
virtual Input Input [get]
 Gets the assigned input. More...
 
virtual Vector2 Velocity [get, protected set]
 The characters velocity. For details of what this means see Character.VelocityType. More...
 
virtual Vector2 PreviousVelocity [get, protected set]
 The characters velocity in the previous frame. More...
 
virtual VelocityType VelocityType [get]
 How is the characters velocity currently represented. More...
 
virtual bool Grounded [get, protected set]
 Returns true if we are grounded or false otherwise. More...
 
virtual bool OnLadder [get, protected set]
 If the character is currently controlled by a ladder the character is considered to be on ladder. More...
 
virtual float TimeSinceGrounded [get, protected set]
 Tracks how much time has passed since the character was last grounded. More...
 
virtual float TimeSinceGroundedOrOnLadder [get, protected set]
 Tracks how much time has passed since the character was last grounded OR on a ladder. Useful for movements that can happen when grounded or when a ladder (like jump). More...
 
virtual float TimeFalling [get, protected set]
 Tracks how much time has passed since the character started falling. More...
 
virtual float TimeSinceSlope [get, protected set]
 Tracks how much time has passed since the character was on a slope. More...
 
virtual float DefaultGravity [get]
 Gets the default value of gravity. More...
 
virtual float Gravity [get]
 Gets the current value of gravity. More...
 
virtual Collider2D CurrentLadder [get]
 Gets the current ladder or null if no ladder in range. More...
 
virtual Collider2D CurrentWall [get]
 Gets the current wall or null if no wall in range. More...
 
virtual int CurrentWallCollider [get]
 Gets the current wall collider More...
 
float BottomOfFeet [get]
 Returns the y position (in world space) of the bottom of the characters feet. More...
 
float RightExtent [get]
 Returns the x position (in world space) of the rightmost of the characters colliders. More...
 
float LeftExtent [get]
 Returns the x position (in world space) of the leftmost of the characters colliders. More...
 
virtual AnimationState AnimationState [get, protected set]
 The characters current animation state. More...
 
virtual int FacingDirection [get]
 Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. More...
 
virtual int? LastFacedDirection [get]
 Returns the direction the character is facing, but if direction is currently 0 instead returns the direction last faced. More...
 
virtual RaycastType ParentRaycastType [get, set]
 Gets or sets the type of the raycast for the parent platform. Value has no meaning if not parented. More...
 
virtual Platform ParentPlatform [get, set]
 Gets or sets the parent platform. More...
 
virtual Platform StoodOnPlatform [get, set]
 Gets or sets the platform the charater is currently standing on (even if they aren't parented to it). More...
 
virtual float SlopeTargetRotation [get]
 If slopes are on this is the rotation we are rotating towards. More...
 
float SlopeActualRotation [get]
 If slopes are on this is the rotation we are currently at. More...
 
float PreviousRotation [get, protected set]
 If slopes are on this is the rotation we were previously targetting. NOTE: This is actually target rotation from 2 frames ago, as if we use one we often get the delta angle between the real target and the new angle due to the transition frame. More...
 
virtual float MinSideAngle [get]
 Gets the minimum angle at which geometry is considered a wall. More...
 
virtual float Friction [get, set]
 Gets or sets the current friction value or -1 if the movement should use its own default. More...
 
virtual float IgnoredSlope [get, set]
 Gets or sets the ignored slope. The ignored slope is used primary for internal physics calculations and is the largest slope that was ignored by the side colliders last frame. More...
 
virtual bool IsGravityFlipped [get]
 Gets a value indicating whether this characters gravity has been flipped. More...
 
virtual string OverrideState [get, protected set]
 Gets the animation override state. More...
 
virtual GroundMovement DefaultGroundMovement [get]
 Gets the default ground movement. More...
 
virtual AirMovement DefaultAirMovement [get]
 Gets the default air movement. More...
 
virtual Movement ActiveMovement [get]
 Gets the currently active movement. More...
 
virtual bool IsAttacking [get]
 Gets a value indicating whether this instance is attacking. More...
 
virtual float AttackNormalisedTime [get]
 Gets the normalised time of the current attack or -1 if not attacking. More...
 
virtual string AttackName [get]
 Gets the name of the current attack or null if not attacking. More...
 
virtual AttackLocation AttackLocation [get]
 Gets the location of the current attack or ANY if not attacking More...
 
virtual bool AttackHasHit [get]
 Returns true if the current attacks hit box has hit an enemy. More...
 
virtual int ZLayer [get, set]
 Gets the characters current z layer. More...
 
virtual int GroundLayer [get, set]
 Gets or sets the feet layer: the layer the character is currently standing on if grounded. More...
 
virtual Collider2D GroundCollider [get, set]
 Gets or sets the feet collider: the collider the character is currently standing on if grounded. More...
 
virtual int FootCount [get]
 How many feet colliders the character has; handy for some calculations. More...
 
virtual int GroundedFootCount [get, set]
 How many feet colliders are on the ground. Usually called only from BaseCollissions. More...
 
virtual int CurrentWallColliderCount [get, protected set]
 How many wall colliders hit the current wall this frame. More...
 
virtual bool WouldHitHeadThisFrame [get, set]
 Did we hit our head this frame? More...
 
bool InputEnabled [get, set]
 Gets or sets a value indicating whether input is enabled for this Character. 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...
 
- Properties inherited from PlatformerPro.IMob
AnimationState AnimationState [get]
 The current animation state. More...
 
int FacingDirection [get]
 Returns the direction being faced. 0 for none, 1 for right, -1 for left. More...
 
int LastFacedDirection [get]
 Returns the direction being faced, but if direction is currently 0 instead returns the direction last faced. More...
 
Vector2 Velocity [get]
 The characters velocity relative to self. More...
 
Vector2 PreviousVelocity [get]
 The characters velocity in the previous frame relative to self. More...
 
float SlopeTargetRotation [get]
 If slopes are on this is the rotation we are rotating towards. More...
 
float SlopeActualRotation [get]
 If slopes are on this is the rotation we are currently on. More...
 
float PreviousRotation [get]
 If slopes are on this is the rotation we were at last frame. More...
 
float IgnoredSlope [get, set]
 Gets the ignored slope. The ignored slope is used primary for internal physics calculations and is the largest slope that was ignored by the side colliders last frame. More...
 
float MinSideAngle [get]
 Gets the minimum angle at which geometry is considered a wall. More...
 
int ZLayer [get, set]
 Gets or sets the characters current z layer. More...
 
bool Grounded [get]
 Returns true if we are grounded or false otherwise. More...
 
int GroundLayer [get]
 If grounded this is the layer of the ground. Undefined if not grounded. More...
 
float Gravity [get]
 Gravity currently acting on the character. More...
 
float Friction [get, set]
 Gets the friction. More...
 

Events

System.EventHandler< AnimationEventArgsChangeAnimationState
 Event for animation state changes. More...
 
System.EventHandler< SceneEventArgsWillExitScene
 Event for scene exit. More...
 
System.EventHandler< CharacterEventArgsRespawned
 Event for respawning. More...
 
System.EventHandler< AttackEventArgsAttackStarted
 Event for attack starting. More...
 
System.EventHandler< AttackEventArgsAttackFinished
 Event for attack finishing. More...
 
System.EventHandler< ExtraDamageInfoEventArgsAttackCausedDamage
 Event for attack connecting. More...
 
- Events inherited from PlatformerPro.IMob
System.EventHandler< AnimationEventArgsChangeAnimationState
 Event for anmation state changes. More...
 

Detailed Description

The root class for a character. This class ties together movement, animation, and other behaviours.

Member Function Documentation

◆ AboutToExitScene()

virtual void PlatformerPro.Character.AboutToExitScene ( string  newSceneName)
virtual

Called by something that will load a new level (without killing character).

◆ AddAnimationOverride()

virtual void PlatformerPro.Character.AddAnimationOverride ( string  overrideState)
virtual

Adds an animation override. NOTE: Currently only one override is supported at a time. Note overrides are used to refer to an animator or layer override (depending on animation type) not forcing the override of a single animation which is done with ForceAnimation().

Parameters
overrideStateOverride State, null values iwll be ignored.

◆ AddIgnoredCollider()

virtual void PlatformerPro.Character.AddIgnoredCollider ( Collider2D  collider)
virtual

Adds a collider to the list of ignored colliders.

Parameters
colliderCollider.

◆ AddToTaggedProperty() [1/2]

virtual void PlatformerPro.Character.AddToTaggedProperty ( string  name,
float  value 
)
virtual

Adds to the named property across all applicable movements.

Parameters
nameProperty name.
valueValue to set.

◆ AddToTaggedProperty() [2/2]

virtual void PlatformerPro.Character.AddToTaggedProperty ( string  name,
float  value,
List< System.Type >  excludedTypes 
)
virtual

Adds to the named property across all applicable movements.

Parameters
nameProperty name.
valueValue to set.
excludedTypesMovements of this type will not have their value changed.

◆ AddVelocity()

virtual void PlatformerPro.Character.AddVelocity ( float  x,
float  y,
bool  velocityIsInWorldSpace 
)
virtual

Adds velocity.

Parameters
xThe velocity to add to x.
yThe velocity to add to y.
velocityIsInWorldSpaceIf true the velocity will not added in world space, otherwise the velocity will be added in character space.

◆ ApplyBaseCollisionsForRaycastType()

virtual Vector2 PlatformerPro.Character.ApplyBaseCollisionsForRaycastType ( RaycastType  type)
virtual

Applies the base collisions for the given raycast collider type.

Parameters
typeType.
Returns
A vector representing the amount of movement applied.

◆ CalculateTargetRotation()

virtual void PlatformerPro.Character.CalculateTargetRotation ( )
protectedvirtual

Use the feet colliders to determine the target rotation.

◆ CheckForLadder()

virtual void PlatformerPro.Character.CheckForLadder ( )
protectedvirtual

Checks if we collided with a ladder.

◆ CreateNamedPropertiesDictionary()

virtual void PlatformerPro.Character.CreateNamedPropertiesDictionary ( )
protectedvirtual

Creates the dictionary used for apply named proeprty changes.

◆ Damage()

virtual void PlatformerPro.Character.Damage ( DamageInfo  info)
virtual

Damages the character which typically triggers some kind of damage animation.

◆ DoBaseCollisions()

virtual void PlatformerPro.Character.DoBaseCollisions ( RaycastType  typeMask)
protectedvirtual

Does the base collisions.

◆ DoBaseCollisionsForRaycastType()

virtual void PlatformerPro.Character.DoBaseCollisionsForRaycastType ( RaycastType  type)
virtual

Executes base collisions for a given raycast collider type. Used by movements that require collision data.

Parameters
typeRaycast type.

◆ DoRotation()

virtual void PlatformerPro.Character.DoRotation ( )
protectedvirtual

Rotate towards the target rotation.

◆ FinishedAttack()

virtual void PlatformerPro.Character.FinishedAttack ( string  name)
virtual

Indicate current attack is finished.

◆ ForceAnimation()

virtual void PlatformerPro.Character.ForceAnimation ( AnimationState  state,
float  minimumTime 
)
virtual

Overrides the animation for the given amount of time.

Parameters
stateState.
minimumTimeMinimum time.

◆ GetClosestCollision()

virtual RaycastHit2D PlatformerPro.Character.GetClosestCollision ( int  i)
virtual

Gets the closest collision for the collider from Colliders at the index i. Note this is generally the collissions from the previous frame when called by a movement during a transition check.

Parameters
iThe index.

◆ HitEnemy()

virtual void PlatformerPro.Character.HitEnemy ( IMob  enemy,
DamageInfo  info 
)
virtual

Called when the character hits an enemy.

Parameters
enemyEnemy that was hit.
infoDamage info.

◆ Init()

virtual void PlatformerPro.Character.Init ( )
protectedvirtual

Set up the character

◆ IsColliderIgnored()

virtual bool PlatformerPro.Character.IsColliderIgnored ( Collider2D  collider)
virtual

Check if a given collider should be ignored in collisions.

Returns
true if this instance is ignoring he specified collider; otherwise, false.
Parameters
colliderCollider.

Implements PlatformerPro.IMob.

◆ Kill()

virtual void PlatformerPro.Character.Kill ( DamageInfo  info)
virtual

Kill the character which typically triggers some kind of death animation.

◆ MultiplyTaggedProperty() [1/2]

virtual void PlatformerPro.Character.MultiplyTaggedProperty ( string  name,
float  value 
)
virtual

Multiplies the named property across all applicable movements.

Parameters
nameProperty name.
valueValue to set.

◆ MultiplyTaggedProperty() [2/2]

virtual void PlatformerPro.Character.MultiplyTaggedProperty ( string  name,
float  value,
List< System.Type >  excludedTypes 
)
virtual

Multiplies the named property across all applicable movements.

Parameters
nameProperty name.
valueValue to set.
excludedTypesMovements of this type will not have their value changed.

◆ NamedPropertySetter()

delegate void PlatformerPro.Character.NamedPropertySetter ( object  value)

Delegate for setting a named property.

◆ OnAttackCausedDamage()

virtual void PlatformerPro.Character.OnAttackCausedDamage ( IMob  enemy,
DamageInfo  info 
)
protectedvirtual

Raises the attack caused damage event.

Parameters
enemyEnemy.
infoInfo.

◆ OnAttackFinished()

virtual void PlatformerPro.Character.OnAttackFinished ( string  name)
protectedvirtual

Raises the attack finished event.

◆ OnAttackStarted()

virtual void PlatformerPro.Character.OnAttackStarted ( )
protectedvirtual

Raises the attack started event.

◆ OnChangeAnimationState() [1/3]

virtual void PlatformerPro.Character.OnChangeAnimationState ( )
virtual

Raises the change animation state event. This version is public and it just triggers a resend not a change.

◆ OnChangeAnimationState() [2/3]

virtual void PlatformerPro.Character.OnChangeAnimationState ( AnimationState  state,
AnimationState  previousState 
)
protectedvirtual

Raises the change animation state event.

Parameters
stateCurrent state.
previousStatePrevious state.

◆ OnChangeAnimationState() [3/3]

virtual void PlatformerPro.Character.OnChangeAnimationState ( AnimationState  state,
AnimationState  previousState,
int  priority 
)
protectedvirtual

Raises the change animation state event.

Parameters
stateCurrent state.
previousStatePrevious state.
priorityAnimaton state priority.

◆ OnRespawned()

virtual void PlatformerPro.Character.OnRespawned ( )
protectedvirtual

Raises the respawned event.

◆ OnSceneWillExit()

virtual void PlatformerPro.Character.OnSceneWillExit ( string  newSceneName)
protectedvirtual

Raises the scene will exit event.

Parameters
newSceneNameNew scene name.

◆ RemoveAnimationOverride()

virtual void PlatformerPro.Character.RemoveAnimationOverride ( string  overrideState)
virtual

Removes an animation override. NOTE: Currently only one override is supported at a time.

Parameters
overrideStateOverride State, will be removed if it matches current value. Use empty string to remove all overrides.

◆ RemoveIgnoredCollider()

virtual void PlatformerPro.Character.RemoveIgnoredCollider ( Collider2D  collider)
virtual

Removes a collider from the list of ignored colliders.

Parameters
colliderCollider.

◆ Respawn() [1/2]

virtual void PlatformerPro.Character.Respawn ( )
virtual

Respawn the character. Called by LevelManager.You generally wont call this directly.

◆ Respawn() [2/2]

virtual void PlatformerPro.Character.Respawn ( RespawnPoint  r,
int  facingDirection 
)
virtual

Respawn the character. Called by LevelManager. You generally wont call this directly. Note: this method is used to set a characters facing direction during respawn and it is NOT about where the character spawns. If you want to respawn your character at a specific respawn point you should use LevelManager.Respawn(Character character, string respawnPoint)

Parameters
rRespawn point to use for Facing Direction
facingDirectionFacing direction to set if the respawn point doesn't have a facing direction override.

◆ SetGrounded()

virtual void PlatformerPro.Character.SetGrounded ( )
protectedvirtual

Sets the grounded state by checking feet colliders.

◆ SetTaggedProperty() [1/2]

virtual void PlatformerPro.Character.SetTaggedProperty ( string  name,
object  value 
)
virtual

Sets the named property across all applicable movements.

Parameters
nameProperty name.
valueValue to set.

◆ SetTaggedProperty() [2/2]

virtual void PlatformerPro.Character.SetTaggedProperty ( string  name,
object  value,
List< System.Type >  excludedTypes 
)
virtual

Sets the named property across all applicable movements.

Parameters
nameProperty name.
valueValue to set.
excludedTypesMovements of this type will not have their value changed.

◆ SetVelocityX()

virtual void PlatformerPro.Character.SetVelocityX ( float  x)
virtual

Sets X velocity.

Parameters
xThe new x speed.

Implements PlatformerPro.IMob.

◆ SetVelocityY()

virtual void PlatformerPro.Character.SetVelocityY ( float  y)
virtual

Sets Y velocity.

Parameters
yThe new y speed.

Implements PlatformerPro.IMob.

◆ SwitchColliders()

virtual void PlatformerPro.Character.SwitchColliders ( )
protectedvirtual

Switches left and right collider direction and flips position of all colliders about y axis.

◆ TransitionMovementControl()

virtual void PlatformerPro.Character.TransitionMovementControl ( )
protectedvirtual

Pass control to the movement most suitable for the current state.

◆ Translate()

virtual void PlatformerPro.Character.Translate ( float  x,
float  y,
bool  applyTransformsInWorldSpace 
)
virtual

Translate the character by the supplied amount.

Parameters
xThe x amount.
yThe y amount.
applyYTransformsInWorldSpaceShould transforms be in world space instead of relative to the character position? Default is true.

Implements PlatformerPro.IMob.

◆ UpdateClosestColliders()

virtual void PlatformerPro.Character.UpdateClosestColliders ( RaycastType  typeMask)
protectedvirtual

Updates the closest colliders array for the given type mask, leaves other types alone.

◆ UpdateCurrentWall()

virtual void PlatformerPro.Character.UpdateCurrentWall ( )
virtual

Member Data Documentation

◆ activeAttack

int PlatformerPro.Character.activeAttack
protected

The active attack.

◆ activeMovement

int PlatformerPro.Character.activeMovement
protected

The index of the currently active movement in the movements array.

◆ animationEventArgs

AnimationEventArgs PlatformerPro.Character.animationEventArgs
protected

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

◆ animationPriority

int PlatformerPro.Character.animationPriority
protected

Current animations animation priority.

◆ animationState

AnimationState PlatformerPro.Character.animationState
protected

The caaracters current animation state.

◆ attackEventArgs

AttackEventArgs PlatformerPro.Character.attackEventArgs
protected

The cached attack event args.

◆ baseMovement

BaseCollisions PlatformerPro.Character.baseMovement
protected

Cached reference to the base movement.

◆ cachedInput

Input PlatformerPro.Character.cachedInput
protected

Cached input to the main input used when re-enabling input.

◆ calculateSlopes

bool PlatformerPro.Character.calculateSlopes = true

Should we Calcualte slope angles for use by movements?

◆ characterRotationType

CharacterRotationType PlatformerPro.Character.characterRotationType

The type of slope rotation.

◆ closestColliders

int [] PlatformerPro.Character.closestColliders
protected

Keeps track of the closest collisions.

◆ colliders

BasicRaycast [] PlatformerPro.Character.colliders
protected

Cached reference to all colliders. Some funciton expect this to be ordered with feet colliders left to right at the start.

◆ collidersToUseForWallCling

List<BasicRaycast> PlatformerPro.Character.collidersToUseForWallCling
protected

A list of colliders that can be used for wall cling (i.e. only those high enough).

◆ currentFacingDirection

int PlatformerPro.Character.currentFacingDirection
protected

The direction currently faced. Used for switch collider calculations.

◆ currentLadder

Collider2D PlatformerPro.Character.currentLadder
protected

The current ladder collider or null if we don't have a ladder.

◆ currentWall

Collider2D PlatformerPro.Character.currentWall
protected

The current wall collider or null if we don't have a wall.

◆ currentWallCollider

int PlatformerPro.Character.currentWallCollider
protected

The current wall collider direction. 1 for right, -1 for left, 0 for none.

◆ damageEventArgs

ExtraDamageInfoEventArgs PlatformerPro.Character.damageEventArgs
protected

The cached damage event args.

◆ defaultAirMovement

int PlatformerPro.Character.defaultAirMovement
protected

The index of the default air movement in the movements array.

◆ defaultAttackMovement

int PlatformerPro.Character.defaultAttackMovement
protected

The index of the default attack movement.

◆ defaultDamageMovement

int PlatformerPro.Character.defaultDamageMovement
protected

The index of the default damage movement in the movements array. -1 for no damage movement.

◆ defaultDeathMovement

int PlatformerPro.Character.defaultDeathMovement
protected

The index of the default death movement in the movements array. -1 for no death movement.

◆ DefaultFallSpeedForIgnoreHeadCollisions

const float PlatformerPro.Character.DefaultFallSpeedForIgnoreHeadCollisions = 0.2f
static

The default fall speed at which head collisions are ignored.

◆ DefaultFeetLookAhead

const float PlatformerPro.Character.DefaultFeetLookAhead = 0.2f
static

The default feet look ahead.

◆ DefaultGroundedLeeway

const float PlatformerPro.Character.DefaultGroundedLeeway = 0.1f
static

The default time after leaving ground for which the character is still conisdered to be on the ground.

◆ DefaultGroundedLookAhead

const float PlatformerPro.Character.DefaultGroundedLookAhead = 0.05f
static

The default grounded look ahead.

◆ defaultGroundMovement

int PlatformerPro.Character.defaultGroundMovement
protected

The index of the default ground movement in the movements array.

◆ defaultLadderMovement

int PlatformerPro.Character.defaultLadderMovement
protected

The index of the default ladder movement in the movements array. -1 for no ladder movement.

◆ DefaultMaxSlopeRotation

const float PlatformerPro.Character.DefaultMaxSlopeRotation = 50
static

The default max slope rotation.

◆ DefaultMinFastFallPassthroughTime

const float PlatformerPro.Character.DefaultMinFastFallPassthroughTime = 0.5f
static

Deafult min ast fall time leeway.

◆ DefaultPassthroughLeeway

const float PlatformerPro.Character.DefaultPassthroughLeeway = -0.1f
static

Deafult passthrough leeway.

◆ DefaultRotationSpeed

const float PlatformerPro.Character.DefaultRotationSpeed = 180
static

The default rotation speed.

◆ DefaultSideAngle

const float PlatformerPro.Character.DefaultSideAngle = 50
static

The default side angle.

◆ DefaultSideLookAhead

const float PlatformerPro.Character.DefaultSideLookAhead = 0.1f
static

The default side look ahead.

◆ DefaultTerminalVelocity

const float PlatformerPro.Character.DefaultTerminalVelocity = -15.0f
static

Defauly terminal velocity

◆ defaultWallMovement

int PlatformerPro.Character.defaultWallMovement
protected

The index of the default wall movement in the movements array. -1 for no wall movement.

◆ detectAllWalls

bool PlatformerPro.Character.detectAllWalls
protected

Detect all walls for use by wall movements?

◆ detectLaddersByTag

bool PlatformerPro.Character.detectLaddersByTag
protected

Should we use a tag to detect ladders, default will use layer.

◆ detectWallsByTag

bool PlatformerPro.Character.detectWallsByTag
protected

Detect walls by tag or layer?

◆ disabledInput

DisabledInput PlatformerPro.Character.disabledInput
protected

Reference to the disabled input. Used when InputEnabled is set to false.

◆ downSlopeAcceleration

float PlatformerPro.Character.downSlopeAcceleration = 0

Effect of walking down a slope on base max speed. 0 = none, 1 = increase speed by sine of angle.

◆ EmptyRaycastHit

RaycastHit2D PlatformerPro.Character.EmptyRaycastHit = new RaycastHit2D()
protected

Cached empty ray cast hit.

◆ fallSpeedForIgnoreHeadCollisions

float PlatformerPro.Character.fallSpeedForIgnoreHeadCollisions = DefaultFallSpeedForIgnoreHeadCollisions

Usually set this very low as it gives smoother movement while falling. Can be an issue if you have platforms that move faster downwards than this speed.

◆ feetColliders

BasicRaycast [] PlatformerPro.Character.feetColliders

The feet colliders.

◆ feetLookAhead

float PlatformerPro.Character.feetLookAhead = DefaultFeetLookAhead

How much extra we cast beyond the collider length when checking feet colliders. We do this so we can (for example) detect a landing state.

◆ forcedAnimationState

AnimationState PlatformerPro.Character.forcedAnimationState
protected

The forced animation state.

◆ forcedAnimationTime

float PlatformerPro.Character.forcedAnimationTime
protected

The time remaining to play the forced animation.

◆ geometryLayerMask

LayerMask PlatformerPro.Character.geometryLayerMask = 1

The layers that are considered when working out collisions. i.e. the things we can't move through. Layers in this mask must appear in the layerMask.

See also
Character.layerMask

◆ gravity

Gravity PlatformerPro.Character.gravity
protected

The class that does gravity movement.

◆ grounded

bool PlatformerPro.Character.grounded
protected

Local copy of grounded state.

◆ groundedLeeway

float PlatformerPro.Character.groundedLeeway = DefaultGroundedLeeway

How long after leaving the ground are we still considered grounded?

◆ groundedLookAhead

float PlatformerPro.Character.groundedLookAhead = DefaultGroundedLookAhead

How much extra we cast beyond the collider length when checking feet colliders. We do this so we can (for example) detect a landing state.

◆ headColliders

BasicRaycast [] PlatformerPro.Character.headColliders

The head colliders.

◆ ignoredColliders

HashSet<Collider2D> PlatformerPro.Character.ignoredColliders
protected

A list of colliders to ingore during collisions.

◆ ignoredSlope

float PlatformerPro.Character.ignoredSlope
protected

The angle of the ignored slope.

◆ input

Input PlatformerPro.Character.input
protected

Cached copy of the input.

◆ ladderLayerNumber

int PlatformerPro.Character.ladderLayerNumber = -1
protected

Cached conversion of ladder layer to layer int.

◆ ladderLayerOrTagName

string PlatformerPro.Character.ladderLayerOrTagName
protected

Layers or tag name used for ladder detection.

The transform.

◆ layerMask

LayerMask PlatformerPro.Character.layerMask = 1

All layers that we collide with. Note that just because something is in this group it doesn't mean we do anything about collisions with it. For example this mask includes layers like ladders and triggers which are ignored when responding to collisions.

See also
Character.geometryLayerMask

◆ leftColliders

BasicRaycast [] PlatformerPro.Character.leftColliders

The left side colliders.

◆ maxSlopeRotation

float PlatformerPro.Character.maxSlopeRotation = DefaultMaxSlopeRotation

How far can the character rotate in degrees.

◆ minFastFallPassthroughTime

float PlatformerPro.Character.minFastFallPassthroughTime = DefaultMinFastFallPassthroughTime

When we fall fast we need to consider passthroughs that we fell past but should have snapped to. However at the very peak of a jump this can cause us to snap oddly. This constant stops that happening by ignoring fall times smaller than this.

◆ minimumWallColliders

int PlatformerPro.Character.minimumWallColliders
protected

The minimum required colliders from the various Wall movements.

◆ movements

Movement [] PlatformerPro.Character.movements
protected

Cached references to all the movements.

◆ myTransform

Transform PlatformerPro.Character.myTransform
protected

Cached copy of the characters transform.

◆ namedProperties

Dictionary<string, List<System.Reflection.FieldInfo> > PlatformerPro.Character.namedProperties
protected

Dictionary of names properties to field info.

◆ overrideState

string PlatformerPro.Character.overrideState
protected

Current animation override.

◆ parentPlatform

Platform PlatformerPro.Character.parentPlatform
protected

The parent platform.

◆ parentRaycastType

RaycastType PlatformerPro.Character.parentRaycastType
protected

Tracks the raycast type we are using for parent calculation.

◆ parentTransform

Transform PlatformerPro.Character.parentTransform
protected

The transform of th parent platform.

◆ passthroughLayerMask

LayerMask PlatformerPro.Character.passthroughLayerMask

The layers that the character can walk on top of but can passthrough in other directions.

See also
Character.layerMask

◆ passthroughLeeway

float PlatformerPro.Character.passthroughLeeway = DefaultPassthroughLeeway

At what point will a passthrough collider consider itself groudned. Too small and you fall through platforms. Too large and you snap oddly. Usually the default is okay unless you change gravity dramatically.

◆ previousRotation

float PlatformerPro.Character.previousRotation
protected

The previous frames target rotation.

◆ rightColliders

BasicRaycast [] PlatformerPro.Character.rightColliders

The right side colliders.

◆ rotateToSlopes

bool PlatformerPro.Character.rotateToSlopes = false

Should we allow the character to walk on slopes?

◆ rotationPoint

int PlatformerPro.Character.rotationPoint
protected

Position of the feet collider in the feet colliders array that we should rotate around.

◆ rotationSpeed

float PlatformerPro.Character.rotationSpeed = DefaultRotationSpeed

How fast the character rotates to match a slope. Measured in degrees per second.

◆ sideAngle

float PlatformerPro.Character.sideAngle = DefaultSideAngle

The minimum angle at which a wall needs to be at for it to be considered a "side".

◆ sideLookAhead

float PlatformerPro.Character.sideLookAhead = DefaultSideLookAhead

How much extra we cast beyond the collider length when checking side colliders. We do this so we can (for example) detect a wall.

◆ slope

float PlatformerPro.Character.slope
protected

If slopes are on this is the rotation we are rotating towards.

◆ snapToGroundOnSlopesOnly

bool PlatformerPro.Character.snapToGroundOnSlopesOnly = true

If true snap to ground will only apply on slopes.

◆ switchCollidersOnDirectionChange

bool PlatformerPro.Character.switchCollidersOnDirectionChange

Should we switch left and right colliders when the character changes direction (used for asymmetric characters).

◆ terminalVelocity

float PlatformerPro.Character.terminalVelocity = DefaultTerminalVelocity

Maximum fall speed (note that any individual movement may override this if it wants to).

◆ timeForFallState

float PlatformerPro.Character.timeForFallState = 0.1f

How long do we need to wait before we change the state to falling. This stops minor ground preturbations causing us to trigger the fall animation.

◆ upSlopeDeceleration

float PlatformerPro.Character.upSlopeDeceleration = 0

Effect of walking up a slope on base max speed. 0 = none, 1 = reduce speed by sine of angle.

◆ wallLayerNumber

int PlatformerPro.Character.wallLayerNumber = -1
protected

Cached conversion of wall layer to layer int.

◆ wallLayerOrTagName

string PlatformerPro.Character.wallLayerOrTagName
protected

Layer or tag name for wall detection.

Property Documentation

◆ ActiveMovement

virtual Movement PlatformerPro.Character.ActiveMovement
get

Gets the currently active movement.

◆ AnimationState

virtual AnimationState PlatformerPro.Character.AnimationState
getprotected set

The characters current animation state.

◆ AttackHasHit

virtual bool PlatformerPro.Character.AttackHasHit
get

Returns true if the current attacks hit box has hit an enemy.

◆ AttackLocation

virtual AttackLocation PlatformerPro.Character.AttackLocation
get

Gets the location of the current attack or ANY if not attacking

◆ AttackName

virtual string PlatformerPro.Character.AttackName
get

Gets the name of the current attack or null if not attacking.

◆ AttackNormalisedTime

virtual float PlatformerPro.Character.AttackNormalisedTime
get

Gets the normalised time of the current attack or -1 if not attacking.

◆ BottomOfFeet

float PlatformerPro.Character.BottomOfFeet
get

Returns the y position (in world space) of the bottom of the characters feet.

◆ Breath

virtual Breath PlatformerPro.Character.Breath
getprotected set

Gets breath for this Character. Can be null if Character does not have Breath.

◆ CharacterHealth

virtual CharacterHealth PlatformerPro.Character.CharacterHealth
getprotected set

Gets CharacterHealth for this Character. Can be null if Character does not have a CharacterHealth.

◆ Colliders

virtual BasicRaycast [] PlatformerPro.Character.Colliders
getset

Gets or sets the colliders.

The colliders.

◆ CurrentCollisions

virtual RaycastHit2D [][] PlatformerPro.Character.CurrentCollisions
getprotected set

Gets the current collisions.

◆ CurrentLadder

virtual Collider2D PlatformerPro.Character.CurrentLadder
get

Gets the current ladder or null if no ladder in range.

The current ladder.

◆ CurrentWall

virtual Collider2D PlatformerPro.Character.CurrentWall
get

Gets the current wall or null if no wall in range.

The current wall.

◆ CurrentWallCollider

virtual int PlatformerPro.Character.CurrentWallCollider
get

Gets the current wall collider

The current wall.

◆ CurrentWallColliderCount

virtual int PlatformerPro.Character.CurrentWallColliderCount
getprotected set

How many wall colliders hit the current wall this frame.

◆ DefaultAirMovement

virtual AirMovement PlatformerPro.Character.DefaultAirMovement
get

Gets the default air movement.

◆ DefaultGravity

virtual float PlatformerPro.Character.DefaultGravity
get

Gets the default value of gravity.

◆ DefaultGroundMovement

virtual GroundMovement PlatformerPro.Character.DefaultGroundMovement
get

Gets the default ground movement.

◆ EquipmentManager

virtual EquipmentManager PlatformerPro.Character.EquipmentManager
getprotected set

Gets EquipmentManager for this Character. Can be null if Character does not have an EquipmentManager.

◆ FacingDirection

virtual int PlatformerPro.Character.FacingDirection
get

Returns the direction the character is facing. 0 for none, 1 for right, -1 for left.

◆ FootCount

virtual int PlatformerPro.Character.FootCount
get

How many feet colliders the character has; handy for some calculations.

◆ Friction

virtual float PlatformerPro.Character.Friction
getset

Gets or sets the current friction value or -1 if the movement should use its own default.

◆ Gravity

virtual float PlatformerPro.Character.Gravity
get

Gets the current value of gravity.

◆ GroundCollider

virtual Collider2D PlatformerPro.Character.GroundCollider
getset

Gets or sets the feet collider: the collider the character is currently standing on if grounded.

◆ Grounded

virtual bool PlatformerPro.Character.Grounded
getprotected set

Returns true if we are grounded or false otherwise.

◆ GroundedFootCount

virtual int PlatformerPro.Character.GroundedFootCount
getset

How many feet colliders are on the ground. Usually called only from BaseCollissions.

◆ GroundLayer

virtual int PlatformerPro.Character.GroundLayer
getset

Gets or sets the feet layer: the layer the character is currently standing on if grounded.

◆ IgnoredSlope

virtual float PlatformerPro.Character.IgnoredSlope
getset

Gets or sets the ignored slope. The ignored slope is used primary for internal physics calculations and is the largest slope that was ignored by the side colliders last frame.

The ignored slope.

◆ Input

virtual Input PlatformerPro.Character.Input
get

Gets the assigned input.

◆ InputEnabled

bool PlatformerPro.Character.InputEnabled
getset

Gets or sets a value indicating whether input is enabled for this Character.

true if input enabled; otherwise, false.

◆ Inventory

virtual Inventory PlatformerPro.Character.Inventory
getprotected set

Gets Inventory for this Character. Can be null if Character does not have an Inventory.

◆ IsAttacking

virtual bool PlatformerPro.Character.IsAttacking
get

Gets a value indicating whether this instance is attacking.

true if this instance is attacking; otherwise, false.

◆ IsGravityFlipped

virtual bool PlatformerPro.Character.IsGravityFlipped
get

Gets a value indicating whether this characters gravity has been flipped.

◆ ItemManager

virtual ItemManager PlatformerPro.Character.ItemManager
getprotected set

Gets ItemManager for this Character. Can be null if Character does not have an ItemManager.

◆ LastFacedDirection

virtual int? PlatformerPro.Character.LastFacedDirection
get

Returns the direction the character is facing, but if direction is currently 0 instead returns the direction last faced.

◆ LeftExtent

float PlatformerPro.Character.LeftExtent
get

Returns the x position (in world space) of the leftmost of the characters colliders.

◆ MinSideAngle

virtual float PlatformerPro.Character.MinSideAngle
get

Gets the minimum angle at which geometry is considered a wall.

◆ OnLadder

virtual bool PlatformerPro.Character.OnLadder
getprotected set

If the character is currently controlled by a ladder the character is considered to be on ladder.

◆ OverrideState

virtual string PlatformerPro.Character.OverrideState
getprotected set

Gets the animation override state.

◆ ParentPlatform

virtual Platform PlatformerPro.Character.ParentPlatform
getset

Gets or sets the parent platform.

◆ ParentRaycastType

virtual RaycastType PlatformerPro.Character.ParentRaycastType
getset

Gets or sets the type of the raycast for the parent platform. Value has no meaning if not parented.

◆ PlayerId

virtual int PlatformerPro.Character.PlayerId
getset

Stores the player that is asociated with this Character.

The player identifier.

◆ PowerUpManager

virtual PowerUpManager PlatformerPro.Character.PowerUpManager
getprotected set

Gets PowerUpManager for this Character. Can be null if Character does not have a PowerUpManager.

◆ PreviousRotation

float PlatformerPro.Character.PreviousRotation
getprotected set

If slopes are on this is the rotation we were previously targetting. NOTE: This is actually target rotation from 2 frames ago, as if we use one we often get the delta angle between the real target and the new angle due to the transition frame.

◆ PreviousVelocity

virtual Vector2 PlatformerPro.Character.PreviousVelocity
getprotected set

The characters velocity in the previous frame.

◆ RightExtent

float PlatformerPro.Character.RightExtent
get

Returns the x position (in world space) of the rightmost of the characters colliders.

◆ SlopeActualRotation

float PlatformerPro.Character.SlopeActualRotation
get

If slopes are on this is the rotation we are currently at.

◆ SlopeTargetRotation

virtual float PlatformerPro.Character.SlopeTargetRotation
get

If slopes are on this is the rotation we are rotating towards.

◆ StoodOnPlatform

virtual Platform PlatformerPro.Character.StoodOnPlatform
getset

Gets or sets the platform the charater is currently standing on (even if they aren't parented to it).

◆ TimeFalling

virtual float PlatformerPro.Character.TimeFalling
getprotected set

Tracks how much time has passed since the character started falling.

◆ TimeSinceGrounded

virtual float PlatformerPro.Character.TimeSinceGrounded
getprotected set

Tracks how much time has passed since the character was last grounded.

◆ TimeSinceGroundedOrOnLadder

virtual float PlatformerPro.Character.TimeSinceGroundedOrOnLadder
getprotected set

Tracks how much time has passed since the character was last grounded OR on a ladder. Useful for movements that can happen when grounded or when a ladder (like jump).

◆ TimeSinceSlope

virtual float PlatformerPro.Character.TimeSinceSlope
getprotected set

Tracks how much time has passed since the character was on a slope.

◆ Transform

virtual Transform PlatformerPro.Character.Transform
get

Gets cache copy of the transform.

◆ Velocity

virtual Vector2 PlatformerPro.Character.Velocity
getprotected set

The characters velocity. For details of what this means see Character.VelocityType.

◆ VelocityType

virtual VelocityType PlatformerPro.Character.VelocityType
get

How is the characters velocity currently represented.

This is here because different classes of movements are often best implemented with different ways of representing velocity (for example for most platform ground movements X velocity is best handled as relative to character angle).

◆ WouldHitHeadThisFrame

virtual bool PlatformerPro.Character.WouldHitHeadThisFrame
getset

Did we hit our head this frame?

◆ ZLayer

virtual int PlatformerPro.Character.ZLayer
getset

Gets the characters current z layer.

The Z layer.

Event Documentation

◆ AttackCausedDamage

System.EventHandler<ExtraDamageInfoEventArgs> PlatformerPro.Character.AttackCausedDamage

Event for attack connecting.

◆ AttackFinished

System.EventHandler<AttackEventArgs> PlatformerPro.Character.AttackFinished

Event for attack finishing.

◆ AttackStarted

System.EventHandler<AttackEventArgs> PlatformerPro.Character.AttackStarted

Event for attack starting.

◆ ChangeAnimationState

System.EventHandler<AnimationEventArgs> PlatformerPro.Character.ChangeAnimationState

Event for animation state changes.

◆ Respawned

System.EventHandler<CharacterEventArgs> PlatformerPro.Character.Respawned

Event for respawning.

◆ WillExitScene

System.EventHandler<SceneEventArgs> PlatformerPro.Character.WillExitScene

Event for scene exit.


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