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

A wall movement class that grabs a ledge and climbs up it. More...

Inheritance diagram for PlatformerPro.WallMovement_LedgeClimb:
PlatformerPro.WallMovement PlatformerPro.BaseMovement< WallMovement >

Public Member Functions

override void DoMove ()
 Moves the character. More...
 
override Movement Init (Character character, MovementVariable[] movementData)
 Initialise the movement with the given movement data. More...
 
override bool WantsCling ()
 Gets a value indicating whether this movement wants to intiate a wall clinging behaviour. More...
 
override void DoCling ()
 
override bool ForceMaintainControl ()
 If this is true then the movement wants to maintain control of the character even if default transition conditions suggest it shouldn't. In this case control unless the character dismounts. More...
 
override void LosingControl ()
 Called when the movement loses control. Override to do any reset type actions. You should ensure that character velocity is reset back to world-relative velocity here. More...
 
- Public Member Functions inherited from PlatformerPro.BaseMovement< WallMovement >
sealed override Movement Init (Character character)
 Initialise this movement. More...
 
bool IsMovementDataDifferent (MovementVariable[] originalMovementData)
 Determines whether this instances movement data is different from the supplied originalMovementData. More...
 

Public Attributes

LedgeDetectionType ledgeDetectionType
 How do we detect if wall is actually a ledge. More...
 
GapDetectionType gapDetectionType
 How do we detect if there is a gap the character can move through. More...
 
LedgeClimbAnimationTargetting animationTargetting
 How do we target the character at the ledge. More...
 
float fallTime = 0.33f
 How long to fall from the ledge wihtout rechecking for ledge. Used to ensure the character can't regrab the ledge they just fell from. More...
 
float maxGraspLeeway
 Maximum distance below the ledge at which the character can move from reach to grasp. More...
 
float minGraspLeeway
 Minimum distance below the ledge at which the character can move from reach to grasp. More...
 
float minReachTime
 How long (in seconds) must a character reach out for the ledge before the are allowed to grab it. More...
 

Protected Member Functions

virtual bool CheckLedge ()
 Checks the ledge using the selected ledge dection type. More...
 
virtual bool CheckGap ()
 Checked for a gap using the selected gap detection type. More...
 
virtual bool DoGapDectionFromSideColliders ()
 Check for a gap by casting rays extending along the side colldiers. More...
 
virtual void CheckForAnimationStateTransition ()
 Checks for animation state transition. I.e. when ledge climb state should be changed based on the animation state. More...
 
virtual void MoveToHangPosition ()
 Transform the character to the correct hang position so the hands are hanging form the edge More...
 
virtual void MoveToDismountPosition ()
 When dismounting we do the opposite of move to hang. More...
 
virtual bool CheckGraspLeeway (bool checkMin)
 Checks the grasp leeway. More...
 
virtual bool CheckForGrab ()
 Check if a grasp should become a grab. More...
 
virtual bool UserPressingFallKey ()
 Is the user pressing a key that causes them to fall. More...
 
virtual bool UserPressingClimbKey ()
 Is the user pressing a key that causes them to climb. More...
 

Protected Attributes

Vector2 ledgeOffset
 Stores the offset for the ledge when in BOX mode. More...
 
Vector2 standOffset
 Stores the offset for the standing position. More...
 
Vector2 dismountOffset
 Stores the offset for the dismount position. More...
 
HumanBodyBones graspingBone
 Bone to use for BONE targetting while grasping. More...
 
LedgeClimbState ledgeClimbState
 Current state of the ledge climb. More...
 
Animator myAnimator
 If the animator drives animation state then keep a cached copy. More...
 
SpriteRenderer myRenderer
 
int facingDirection
 Cache the facing direction. More...
 
float fallTimer
 While this is bigger than true ignore all ledge grabs (becasue the user told us to drop). More...
 
float reachTimer
 Determines how long we have been reaching for a ledge. More...
 
Vector2 initialSpritePivot
 Cached position of the inital sprite pivot. More...
 
Collider2D currentWall
 Cached copy of the ledge climb wall. More...
 
Vector2 currentTransformOffset
 Defines the current offset as an offset from the current wall. More...
 
- Protected Attributes inherited from PlatformerPro.BaseMovement< WallMovement >
Movement implementation
 The class that will do the movement. More...
 
string movementType
 The type of movement as a string. More...
 
MovementVariable[] movementData
 Data that should be applied to the movement type on init. More...
 

Static Protected Attributes

const float DefaultMinReachTime = 0.1f
 The default minimum reach time. More...
 
const int LedgeDetectionTypeIndex = 2
 The index of the property for ledge detection type. More...
 
const int GapDetectionTypeIndex = 3
 The index of the property for gap detection type. More...
 
const int AnimationTargettingIndex = 4
 The index of the animation target type. More...
 
const int LedgeOffsetIndex = 5
 The index of the ledge offset. More...
 
const int GraspingBoneIndex = 6
 The index of the grasping bone. More...
 
const int StandOffsetIndex = 7
 The index of the stand offset. More...
 
const int MaxGraspLeewayIndex = 8
 The index of the max grasp leeway. More...
 
const int MinGraspLeewayIndex = 9
 The index of the minimum grasp leeway. More...
 
const int MinReachTimeIndex = 10
 The index of the minimum reach time. More...
 
const int FallTimeIndex = 11
 The index of the fall time. More...
 
const int DismountOffsetIndex = 12
 The index of the dismount offset. More...
 
new const int MovementVariableCount = 13
 The size of the movement variable array. More...
 
- Static Protected Attributes inherited from PlatformerPro.WallMovement
const int RequiredCollidersIndex = 1
 The index of the property for the required colliders. /// More...
 
const int MovementVariableCount = 2
 The size of the movement variable array. More...
 
const int DefaultRequiredColliders = 2
 The index of the property for the required colliders. /// More...
 

Properties

new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
Vector2 CurrentLedgePosition [get]
 
override AnimationState AnimationState [get]
 Gets the animation state that this movement wants to set. More...
 
override int FacingDirection [get]
 Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. This overriden version always returns the wall direction. More...
 
override RaycastType ShouldDoBaseCollisions [get]
 Gets a value indicating whether this PlatformerPro.Movement expects the base collisions to be executed after its movement finishes. More...
 
override bool ShouldDoRotations [get]
 Gets a value indicating whether this PlatformerPro.Movement expects the rotations to be calculated and applied by the character. More...
 
override bool ShouldApplyGravity [get]
 Gravity handled internally More...
 
- Properties inherited from PlatformerPro.WallMovement
virtual bool ClingToAllWalls [get, protected set]
 If true this applies to all walls and there is no need to use tags or layers to detect walls. More...
 
virtual bool DetectWallsByTag [get, protected set]
 Should we find walls by tag or by layer. If true we will use tags, if false we will use layers. Tags are easier to use but come with an allocation cost. More...
 
virtual string WallLayerOrTagName [get, protected set]
 The name of the wall layer if we find by layers, or the tag name if we find by tags. More...
 
virtual int RequiredColliders [get, protected set]
 The number of colliders required for wall clinging to intiate. Note these colliders don't need to be hitting the same wall just a wall on the same side (so you can move up a wall made of tiled boxes). More...
 
override bool ShouldDoRotations [get]
 Gets a value indicating whether this PlatformerPro.Movement expects the rotations to be calculated and applied by the character. By default walls don't do this. More...
 
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
- Properties inherited from PlatformerPro.BaseMovement< WallMovement >
virtual string MovementType [get, set]
 The type of movement as a string. More...
 
virtual MovementVariable[] MovementData [get, set]
 Data that should be applied to the movement type on init. More...
 
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
override bool Enabled [get, set]
 A custom enable which base movements can use to pass on enable values. More...
 
override Movement Implementation [get]
 Gets the underlying implementation. More...
 

Detailed Description

A wall movement class that grabs a ledge and climbs up it.

Member Function Documentation

◆ CheckForAnimationStateTransition()

virtual void PlatformerPro.WallMovement_LedgeClimb.CheckForAnimationStateTransition ( )
protectedvirtual

Checks for animation state transition. I.e. when ledge climb state should be changed based on the animation state.

Don't do this transition in baked mode as we need to apply the transform in LateUpdate instead

◆ CheckForGrab()

virtual bool PlatformerPro.WallMovement_LedgeClimb.CheckForGrab ( )
protectedvirtual

Check if a grasp should become a grab.

Returns
true, if we should grab, false otherwise.

◆ CheckGap()

virtual bool PlatformerPro.WallMovement_LedgeClimb.CheckGap ( )
protectedvirtual

Checked for a gap using the selected gap detection type.

Returns
true, if gap was checked, false otherwise.

◆ CheckGraspLeeway()

virtual bool PlatformerPro.WallMovement_LedgeClimb.CheckGraspLeeway ( bool  checkMin)
protectedvirtual

Checks the grasp leeway.

Returns
true, if grasp leeway was checked, false otherwise.
Parameters
checkMinIf set to true check min constraint else just check max.

◆ CheckLedge()

virtual bool PlatformerPro.WallMovement_LedgeClimb.CheckLedge ( )
protectedvirtual

Checks the ledge using the selected ledge dection type.

Returns
true, if ledge was found, false otherwise.

◆ DoCling()

override void PlatformerPro.WallMovement_LedgeClimb.DoCling ( )
virtual

Does the cling.

Reimplemented from PlatformerPro.WallMovement.

◆ DoGapDectionFromSideColliders()

virtual bool PlatformerPro.WallMovement_LedgeClimb.DoGapDectionFromSideColliders ( )
protectedvirtual

Check for a gap by casting rays extending along the side colldiers.

Returns
true, if gap dection from side colliders was done, false otherwise.

◆ DoMove()

override void PlatformerPro.WallMovement_LedgeClimb.DoMove ( )

Moves the character.

◆ ForceMaintainControl()

override bool PlatformerPro.WallMovement_LedgeClimb.ForceMaintainControl ( )

If this is true then the movement wants to maintain control of the character even if default transition conditions suggest it shouldn't. In this case control unless the character dismounts.

◆ Init()

override Movement PlatformerPro.WallMovement_LedgeClimb.Init ( Character  character,
MovementVariable[]  movementData 
)

Initialise the movement with the given movement data.

Parameters
characterCharacter.
movementDataMovement data.

◆ LosingControl()

override void PlatformerPro.WallMovement_LedgeClimb.LosingControl ( )

Called when the movement loses control. Override to do any reset type actions. You should ensure that character velocity is reset back to world-relative velocity here.

◆ MoveToDismountPosition()

virtual void PlatformerPro.WallMovement_LedgeClimb.MoveToDismountPosition ( )
protectedvirtual

When dismounting we do the opposite of move to hang.

◆ MoveToHangPosition()

virtual void PlatformerPro.WallMovement_LedgeClimb.MoveToHangPosition ( )
protectedvirtual

Transform the character to the correct hang position so the hands are hanging form the edge

◆ UserPressingClimbKey()

virtual bool PlatformerPro.WallMovement_LedgeClimb.UserPressingClimbKey ( )
protectedvirtual

Is the user pressing a key that causes them to climb.

Returns
true, if user pressing a climb key, false otherwise.

◆ UserPressingFallKey()

virtual bool PlatformerPro.WallMovement_LedgeClimb.UserPressingFallKey ( )
protectedvirtual

Is the user pressing a key that causes them to fall.

Returns
true, if user pressing a fall key, false otherwise.

◆ WantsCling()

override bool PlatformerPro.WallMovement_LedgeClimb.WantsCling ( )
virtual

Gets a value indicating whether this movement wants to intiate a wall clinging behaviour.

Reimplemented from PlatformerPro.WallMovement.

Member Data Documentation

◆ animationTargetting

LedgeClimbAnimationTargetting PlatformerPro.WallMovement_LedgeClimb.animationTargetting

How do we target the character at the ledge.

◆ AnimationTargettingIndex

const int PlatformerPro.WallMovement_LedgeClimb.AnimationTargettingIndex = 4
staticprotected

The index of the animation target type.

◆ currentTransformOffset

Vector2 PlatformerPro.WallMovement_LedgeClimb.currentTransformOffset
protected

Defines the current offset as an offset from the current wall.

◆ currentWall

Collider2D PlatformerPro.WallMovement_LedgeClimb.currentWall
protected

Cached copy of the ledge climb wall.

◆ DefaultMinReachTime

const float PlatformerPro.WallMovement_LedgeClimb.DefaultMinReachTime = 0.1f
staticprotected

The default minimum reach time.

◆ dismountOffset

Vector2 PlatformerPro.WallMovement_LedgeClimb.dismountOffset
protected

Stores the offset for the dismount position.

◆ DismountOffsetIndex

const int PlatformerPro.WallMovement_LedgeClimb.DismountOffsetIndex = 12
staticprotected

The index of the dismount offset.

◆ facingDirection

int PlatformerPro.WallMovement_LedgeClimb.facingDirection
protected

Cache the facing direction.

◆ fallTime

float PlatformerPro.WallMovement_LedgeClimb.fallTime = 0.33f

How long to fall from the ledge wihtout rechecking for ledge. Used to ensure the character can't regrab the ledge they just fell from.

◆ FallTimeIndex

const int PlatformerPro.WallMovement_LedgeClimb.FallTimeIndex = 11
staticprotected

The index of the fall time.

◆ fallTimer

float PlatformerPro.WallMovement_LedgeClimb.fallTimer
protected

While this is bigger than true ignore all ledge grabs (becasue the user told us to drop).

◆ gapDetectionType

GapDetectionType PlatformerPro.WallMovement_LedgeClimb.gapDetectionType

How do we detect if there is a gap the character can move through.

◆ GapDetectionTypeIndex

const int PlatformerPro.WallMovement_LedgeClimb.GapDetectionTypeIndex = 3
staticprotected

The index of the property for gap detection type.

◆ graspingBone

HumanBodyBones PlatformerPro.WallMovement_LedgeClimb.graspingBone
protected

Bone to use for BONE targetting while grasping.

◆ GraspingBoneIndex

const int PlatformerPro.WallMovement_LedgeClimb.GraspingBoneIndex = 6
staticprotected

The index of the grasping bone.

◆ initialSpritePivot

Vector2 PlatformerPro.WallMovement_LedgeClimb.initialSpritePivot
protected

Cached position of the inital sprite pivot.

◆ ledgeClimbState

LedgeClimbState PlatformerPro.WallMovement_LedgeClimb.ledgeClimbState
protected

Current state of the ledge climb.

◆ ledgeDetectionType

LedgeDetectionType PlatformerPro.WallMovement_LedgeClimb.ledgeDetectionType

How do we detect if wall is actually a ledge.

◆ LedgeDetectionTypeIndex

const int PlatformerPro.WallMovement_LedgeClimb.LedgeDetectionTypeIndex = 2
staticprotected

The index of the property for ledge detection type.

◆ ledgeOffset

Vector2 PlatformerPro.WallMovement_LedgeClimb.ledgeOffset
protected

Stores the offset for the ledge when in BOX mode.

◆ LedgeOffsetIndex

const int PlatformerPro.WallMovement_LedgeClimb.LedgeOffsetIndex = 5
staticprotected

The index of the ledge offset.

◆ maxGraspLeeway

float PlatformerPro.WallMovement_LedgeClimb.maxGraspLeeway

Maximum distance below the ledge at which the character can move from reach to grasp.

◆ MaxGraspLeewayIndex

const int PlatformerPro.WallMovement_LedgeClimb.MaxGraspLeewayIndex = 8
staticprotected

The index of the max grasp leeway.

◆ minGraspLeeway

float PlatformerPro.WallMovement_LedgeClimb.minGraspLeeway

Minimum distance below the ledge at which the character can move from reach to grasp.

◆ MinGraspLeewayIndex

const int PlatformerPro.WallMovement_LedgeClimb.MinGraspLeewayIndex = 9
staticprotected

The index of the minimum grasp leeway.

◆ minReachTime

float PlatformerPro.WallMovement_LedgeClimb.minReachTime

How long (in seconds) must a character reach out for the ledge before the are allowed to grab it.

◆ MinReachTimeIndex

const int PlatformerPro.WallMovement_LedgeClimb.MinReachTimeIndex = 10
staticprotected

The index of the minimum reach time.

◆ MovementVariableCount

new const int PlatformerPro.WallMovement_LedgeClimb.MovementVariableCount = 13
staticprotected

The size of the movement variable array.

◆ myAnimator

Animator PlatformerPro.WallMovement_LedgeClimb.myAnimator
protected

If the animator drives animation state then keep a cached copy.

◆ myRenderer

SpriteRenderer PlatformerPro.WallMovement_LedgeClimb.myRenderer
protected

◆ reachTimer

float PlatformerPro.WallMovement_LedgeClimb.reachTimer
protected

Determines how long we have been reaching for a ledge.

◆ standOffset

Vector2 PlatformerPro.WallMovement_LedgeClimb.standOffset
protected

Stores the offset for the standing position.

◆ StandOffsetIndex

const int PlatformerPro.WallMovement_LedgeClimb.StandOffsetIndex = 7
staticprotected

The index of the stand offset.

Property Documentation

◆ AnimationState

override AnimationState PlatformerPro.WallMovement_LedgeClimb.AnimationState
get

Gets the animation state that this movement wants to set.

◆ CurrentLedgePosition

Vector2 PlatformerPro.WallMovement_LedgeClimb.CurrentLedgePosition
getprotected

◆ FacingDirection

override int PlatformerPro.WallMovement_LedgeClimb.FacingDirection
get

Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. This overriden version always returns the wall direction.

◆ Info

new static MovementInfo PlatformerPro.WallMovement_LedgeClimb.Info
staticget

Static movement info used by the editor.

◆ ShouldApplyGravity

override bool PlatformerPro.WallMovement_LedgeClimb.ShouldApplyGravity
get

Gravity handled internally

◆ ShouldDoBaseCollisions

override RaycastType PlatformerPro.WallMovement_LedgeClimb.ShouldDoBaseCollisions
get

Gets a value indicating whether this PlatformerPro.Movement expects the base collisions to be executed after its movement finishes.

◆ ShouldDoRotations

override bool PlatformerPro.WallMovement_LedgeClimb.ShouldDoRotations
get

Gets a value indicating whether this PlatformerPro.Movement expects the rotations to be calculated and applied by the character.


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