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

Base ground movement for crouch functions which handles core behaviour like More...

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

Public Member Functions

override Movement Init (Character character, MovementVariable[] movementData)
 Initialise the movement with the given movement data. More...
 
override bool WantsGroundControl ()
 Basic implementation for crouch, if the characters holds down and is on the ground they want to crouch. 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

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 Member Functions

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

Protected Attributes

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

Detailed Description

Base ground movement for crouch functions which handles core behaviour like

Member Function Documentation

◆ CheckInput()

virtual bool PlatformerPro.GroundMovement_Crouch.CheckInput ( )
virtual

Check for crouch input.

Returns
true, if crouch input was entered, false otherwise.

Reimplemented in PlatformerPro.GroundMovement_CrouchNoCrawl.

◆ CheckInputAndToggle()

virtual bool PlatformerPro.GroundMovement_Crouch.CheckInputAndToggle ( )
virtual

Check crouching and crouch toggle

Returns
true, if crouch input was entered, false otherwise.

◆ DoMove()

override void PlatformerPro.GroundMovement_Crouch.DoMove ( )

Moves the character.

◆ Grow()

virtual void PlatformerPro.GroundMovement_Crouch.Grow ( )
virtual

Grow the characters colliders back to original size.

◆ GrowHeadAndSides()

virtual void PlatformerPro.GroundMovement_Crouch.GrowHeadAndSides ( )
protectedvirtual

Grows the head and sides.

◆ GrowHurtBox()

virtual void PlatformerPro.GroundMovement_Crouch.GrowHurtBox ( )
protectedvirtual

Grows the hit box.

◆ Init()

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

Initialise the movement with the given movement data.

Parameters
characterCharacter.
movementDataMovement data.

◆ Shrink()

virtual void PlatformerPro.GroundMovement_Crouch.Shrink ( )
virtual

Shrink the characters colliders.

◆ ShrinkHeadAndSides()

virtual void PlatformerPro.GroundMovement_Crouch.ShrinkHeadAndSides ( )
protectedvirtual

Shrinks the head and sides.

◆ ShrinkHurtBox()

virtual void PlatformerPro.GroundMovement_Crouch.ShrinkHurtBox ( )
protectedvirtual

Shrinks the hit box.

◆ WantsGroundControl()

override bool PlatformerPro.GroundMovement_Crouch.WantsGroundControl ( )
virtual

Basic implementation for crouch, if the characters holds down and is on the ground they want to crouch.

Returns
true if control is wanted, false otherwise.

Reimplemented from PlatformerPro.GroundMovement.

Reimplemented in PlatformerPro.GroundMovement_RollOnButton, PlatformerPro.GroundMovement_CrouchWithSlideAndCrawl, PlatformerPro.GroundMovement_CrouchWithSlide, PlatformerPro.GroundMovement_CrouchWithCrawl, and PlatformerPro.GroundMovement_CrouchNoCrawl.

Member Data Documentation

◆ actionButton

int PlatformerPro.GroundMovement_Crouch.actionButton

Action button to use for crouch, -1 means use DOWN instead.

◆ ActionButtonIndex

const int PlatformerPro.GroundMovement_Crouch.ActionButtonIndex = 4
staticprotected

The index of the action button in the movement data.

◆ crouchToggle

bool PlatformerPro.GroundMovement_Crouch.crouchToggle

If true pressing down toggles the crouch rather than requigin crouch to be held.

◆ crouchToggled

bool PlatformerPro.GroundMovement_Crouch.crouchToggled
protected

Stores crouch state.

◆ CrouchToggleIndex

const int PlatformerPro.GroundMovement_Crouch.CrouchToggleIndex = 5
staticprotected

The index of the crouch toggle setting in the movement data.

◆ DefaultActionButton

const int PlatformerPro.GroundMovement_Crouch.DefaultActionButton = -1
staticprotected

The default action button.

◆ DefaultNewHeadHeight

const float PlatformerPro.GroundMovement_Crouch.DefaultNewHeadHeight = 0.5f
staticprotected

The default height of the new head.

◆ DefaultShrinkHurtBoxFactor

const float PlatformerPro.GroundMovement_Crouch.DefaultShrinkHurtBoxFactor = 2.0f
staticprotected

The default shrink hit box factor.

◆ hurtBoxCollider

Collider2D PlatformerPro.GroundMovement_Crouch.hurtBoxCollider
protected

Cached reference to the hitboxes collider.

◆ MovementVariableCount

const int PlatformerPro.GroundMovement_Crouch.MovementVariableCount = 6
staticprotected

The size of the movement variable array.

◆ newHeadExtents

Vector2 [] PlatformerPro.GroundMovement_Crouch.newHeadExtents
protected

Cached copy of the calculated head extents.

◆ newHeadHeight

float PlatformerPro.GroundMovement_Crouch.newHeadHeight

The new height of the head (side colliders higher than this will be ignored).

◆ NewHeadHeightIndex

const int PlatformerPro.GroundMovement_Crouch.NewHeadHeightIndex = 3
staticprotected

The index of the head height in the movement data.

◆ originalHeadExtents

Vector2 [] PlatformerPro.GroundMovement_Crouch.originalHeadExtents
protected

The original extents of the head colliders of the character.

◆ showColliderSettings

bool PlatformerPro.GroundMovement_Crouch.showColliderSettings
protected

Should we show colldier settings in inspetor?

◆ shrinkHeadAndSides

bool PlatformerPro.GroundMovement_Crouch.shrinkHeadAndSides

Should we shrink the head and ignore some sides?

◆ ShrinkHeadAndSidesIndex

const int PlatformerPro.GroundMovement_Crouch.ShrinkHeadAndSidesIndex = 2
staticprotected

The index of shrink head and sides in the movement data.

◆ shrinkHurtBox

bool PlatformerPro.GroundMovement_Crouch.shrinkHurtBox

Should we shrink the hit box?

◆ shrinkHurtBoxFactor

float PlatformerPro.GroundMovement_Crouch.shrinkHurtBoxFactor

How much should we shrink the hit box by?

◆ ShrinkHurtBoxFactorIndex

const int PlatformerPro.GroundMovement_Crouch.ShrinkHurtBoxFactorIndex = 1
staticprotected

The index of the shrink hit box factor in the movement data.

◆ ShrinkHurtBoxIndex

const int PlatformerPro.GroundMovement_Crouch.ShrinkHurtBoxIndex = 0
staticprotected

The index of shrink hit box in the movement data.

Property Documentation

◆ AnimationState

override AnimationState PlatformerPro.GroundMovement_Crouch.AnimationState
get

Gets the animation state that this movement wants to set.

◆ FacingDirection

override int PlatformerPro.GroundMovement_Crouch.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.

◆ Info

new static MovementInfo PlatformerPro.GroundMovement_Crouch.Info
staticget

Static movement info used by the editor.


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