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

Movement for crouching that will slide if moving at speed. More...

Inheritance diagram for PlatformerPro.GroundMovement_CrouchWithSlide:
PlatformerPro.GroundMovement_Crouch PlatformerPro.GroundMovement PlatformerPro.BaseMovement< GroundMovement > PlatformerPro.GroundMovement_CrouchWithSlideAndCrawl

Public Member Functions

override bool WantsGroundControl ()
 If this is true then the movement wants to control the object on thre ground. More...
 
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. More...
 
override void DoMove ()
 Moves the character. More...
 
override void PostCollisionDoMove ()
 Snap to ground. More...
 
override Movement Init (Character character, MovementVariable[] movementData)
 Initialise the mvoement with the given movement data. More...
 
override void GainControl ()
 Called when the movement gets control. Typically used to do initialisation of velocity and the like. 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.GroundMovement_Crouch
override Movement Init (Character character, MovementVariable[] movementData)
 Initialise the movement with the given movement data. More...
 
override void DoMove ()
 Moves the character. More...
 
virtual bool CheckInputAndToggle ()
 Check crouching and crouch toggle More...
 
virtual bool CheckInput ()
 Check for crouch input. More...
 
virtual void Shrink ()
 Shrink the characters colliders. More...
 
virtual void Grow ()
 Grow the characters colliders back to original size. More...
 
- Public Member Functions inherited from PlatformerPro.GroundMovement
virtual void ApplySlopeForce ()
 Applies slope force. More...
 
virtual float ApplySlopeSpeedModifier (float speed)
 Adjusts speed to cater for vertical movement More...
 
virtual float GetSpeed (float baseSpeed)
 Gets the ground speed. More...
 
virtual float GetRunSpeed (float baseRunSpeed)
 Gets the run speed. More...
 
virtual float GetAcceleration (float baseAcceleration)
 Gets the acceleration. More...
 
- Public Member Functions inherited from PlatformerPro.BaseMovement< GroundMovement >
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

float minimumSpeedForSlide
 How fast the character has to be moving for slide to start. More...
 
float maxSpeed
 The maximum travel speed. More...
 
float friction
 The default friction. Platforms can override this. More...
 
float slopeAccelerationFactor
 If non-zero the character will have acceleration applied by slopes based on gravity. The actual force will be f = g sin() * slopeAccelerationFactor. More...
 
float quiesceSpeed
 If a character is moving slower than this stop them moving. More...
 
float ignoreForce
 Forces smaller than this will be ignored (generally applies to, for example, slighlty sloped platforms or very small input values). More...
 
- Public Attributes inherited from PlatformerPro.GroundMovement_Crouch
bool shrinkHurtBox
 Should we shrink the hit box? More...
 
float shrinkHurtBoxFactor
 How much should we shrink the hit box by? More...
 
bool shrinkHeadAndSides
 Should we shrink the head and ignore some sides? More...
 
float newHeadHeight
 The new height of the head (side colliders higher than this will be ignored). More...
 
int actionButton
 Action button to use for crouch, -1 means use DOWN instead. More...
 
bool crouchToggle
 If true pressing down toggles the crouch rather than requigin crouch to be held. More...
 

Protected Attributes

bool crouchStarted
 Tracks if crouch has started. More...
 
- Protected Attributes inherited from PlatformerPro.GroundMovement_Crouch
Collider2D hurtBoxCollider
 Cached reference to the hitboxes collider. More...
 
Vector2[] originalHeadExtents
 The original extents of the head colliders of the character. More...
 
Vector2[] newHeadExtents
 Cached copy of the calculated head extents. More...
 
bool showColliderSettings
 Should we show colldier settings in inspetor? More...
 
bool crouchToggled
 Stores crouch state. More...
 
- Protected Attributes inherited from PlatformerPro.BaseMovement< GroundMovement >
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 DefaultMinimumSpeedForSlide = 1.0f
 The default minimum speed for slide. More...
 
const int MinimumSpeedForSlideIndex = 11
 The index for the minimum speed for slide value in the movement data. More...
 
const int MaxSpeedIndex = 12
 The index of the max speed. More...
 
new const int MovementVariableCount = 13
 The size of the movement variable array. More...
 
- Static Protected Attributes inherited from PlatformerPro.GroundMovement_Crouch
const int ShrinkHurtBoxIndex = 0
 The index of shrink hit box in the movement data. More...
 
const int ShrinkHurtBoxFactorIndex = 1
 The index of the shrink hit box factor in the movement data. More...
 
const int ShrinkHeadAndSidesIndex = 2
 The index of shrink head and sides in the movement data. More...
 
const int NewHeadHeightIndex = 3
 The index of the head height in the movement data. More...
 
const int ActionButtonIndex = 4
 The index of the action button in the movement data. More...
 
const int CrouchToggleIndex = 5
 The index of the crouch toggle setting in the movement data. More...
 
const float DefaultShrinkHurtBoxFactor = 2.0f
 The default shrink hit box factor. More...
 
const float DefaultNewHeadHeight = 0.5f
 The default height of the new head. More...
 
const int DefaultActionButton = -1
 The default action button. More...
 
const int MovementVariableCount = 6
 The size of the movement variable array. More...
 

Properties

new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
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. More...
 
- Properties inherited from PlatformerPro.GroundMovement_Crouch
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
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 input direction. More...
 
- Properties inherited from PlatformerPro.GroundMovement
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
virtual bool SupportsSlidingOnSlopes [get]
 Gets a value indicating whether this PlatformerPro.Movement can support automatic sliding based on the characters slope. More...
 
- Properties inherited from PlatformerPro.BaseMovement< GroundMovement >
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...
 

Additional Inherited Members

- Protected Member Functions inherited from PlatformerPro.GroundMovement_Crouch
virtual void ShrinkHurtBox ()
 Shrinks the hit box. More...
 
virtual void GrowHurtBox ()
 Grows the hit box. More...
 
virtual void ShrinkHeadAndSides ()
 Shrinks the head and sides. More...
 
virtual void GrowHeadAndSides ()
 Grows the head and sides. More...
 
- Protected Member Functions inherited from PlatformerPro.GroundMovement
virtual void SnapToGround ()
 Snaps the character to the ground. More...
 

Detailed Description

Movement for crouching that will slide if moving at speed.

Member Function Documentation

◆ DoMove()

override void PlatformerPro.GroundMovement_CrouchWithSlide.DoMove ( )

Moves the character.

◆ ForceMaintainControl()

override bool PlatformerPro.GroundMovement_CrouchWithSlide.ForceMaintainControl ( )

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

◆ GainControl()

override void PlatformerPro.GroundMovement_CrouchWithSlide.GainControl ( )

Called when the movement gets control. Typically used to do initialisation of velocity and the like.

◆ Init()

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

Initialise the mvoement with the given movement data.

Parameters
characterCharacter.
movementDataMovement data.

◆ LosingControl()

override void PlatformerPro.GroundMovement_CrouchWithSlide.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.

◆ PostCollisionDoMove()

override void PlatformerPro.GroundMovement_CrouchWithSlide.PostCollisionDoMove ( )

Snap to ground.

◆ WantsGroundControl()

override bool PlatformerPro.GroundMovement_CrouchWithSlide.WantsGroundControl ( )
virtual

If this is true then the movement wants to control the object on thre ground.

Returns
true if control is wanted, false otherwise.

Reimplemented from PlatformerPro.GroundMovement_Crouch.

Reimplemented in PlatformerPro.GroundMovement_CrouchWithSlideAndCrawl.

Member Data Documentation

◆ crouchStarted

bool PlatformerPro.GroundMovement_CrouchWithSlide.crouchStarted
protected

Tracks if crouch has started.

◆ DefaultMinimumSpeedForSlide

const float PlatformerPro.GroundMovement_CrouchWithSlide.DefaultMinimumSpeedForSlide = 1.0f
staticprotected

The default minimum speed for slide.

◆ friction

float PlatformerPro.GroundMovement_CrouchWithSlide.friction

The default friction. Platforms can override this.

◆ ignoreForce

float PlatformerPro.GroundMovement_CrouchWithSlide.ignoreForce

Forces smaller than this will be ignored (generally applies to, for example, slighlty sloped platforms or very small input values).

◆ maxSpeed

float PlatformerPro.GroundMovement_CrouchWithSlide.maxSpeed

The maximum travel speed.

◆ MaxSpeedIndex

const int PlatformerPro.GroundMovement_CrouchWithSlide.MaxSpeedIndex = 12
staticprotected

The index of the max speed.

◆ minimumSpeedForSlide

float PlatformerPro.GroundMovement_CrouchWithSlide.minimumSpeedForSlide

How fast the character has to be moving for slide to start.

◆ MinimumSpeedForSlideIndex

const int PlatformerPro.GroundMovement_CrouchWithSlide.MinimumSpeedForSlideIndex = 11
staticprotected

The index for the minimum speed for slide value in the movement data.

◆ MovementVariableCount

new const int PlatformerPro.GroundMovement_CrouchWithSlide.MovementVariableCount = 13
staticprotected

The size of the movement variable array.

◆ quiesceSpeed

float PlatformerPro.GroundMovement_CrouchWithSlide.quiesceSpeed

If a character is moving slower than this stop them moving.

◆ slopeAccelerationFactor

float PlatformerPro.GroundMovement_CrouchWithSlide.slopeAccelerationFactor

If non-zero the character will have acceleration applied by slopes based on gravity. The actual force will be f = g sin() * slopeAccelerationFactor.

Property Documentation

◆ AnimationState

override AnimationState PlatformerPro.GroundMovement_CrouchWithSlide.AnimationState
get

Gets the animation state that this movement wants to set.

◆ FacingDirection

override int PlatformerPro.GroundMovement_CrouchWithSlide.FacingDirection
get

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

◆ Info

new static MovementInfo PlatformerPro.GroundMovement_CrouchWithSlide.Info
staticget

Static movement info used by the editor.


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