Corgi Engine  v8.8
MoreMountains.CorgiEngine.CharacterStairs Class Reference

Add this ability to a character and it'll be able to climb stairs Animation parameter : OnStairs, boolean More...

Inheritance diagram for MoreMountains.CorgiEngine.CharacterStairs:
MoreMountains.CorgiEngine.CharacterAbility MoreMountains.CorgiEngine.CorgiMonoBehaviour

Public Member Functions

override string HelpBoxText ()
 This method is only used to display a helpbox text at the beginning of the ability's inspector. More...
 
virtual void CachePlatformMask ()
 Stores the current controller platform mask More...
 
override void ProcessAbility ()
 Every frame, we check for stairs in front and below the character, we handle input and decide whether or not we should climb stairs or go down them More...
 
override void UpdateAnimator ()
 At the end of the ability's cycle, we send our current crouching and crawling states to the animator More...
 
override void ResetAbility ()
 On reset ability, we cancel all the changes made More...
 
- Public Member Functions inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual void SetInputManager (InputManager inputManager)
 Sets a new input manager for this ability to get input from More...
 
virtual void BindAnimator ()
 Binds the animator from the character and initializes the animator parameters More...
 
virtual void ResetInput ()
 Resets all input for this ability. Can be overridden for ability specific directives More...
 
virtual void EarlyProcessAbility ()
 The first of the 3 passes you can have in your ability. Think of it as EarlyUpdate() if it existed More...
 
virtual void LateProcessAbility ()
 The last of the 3 passes you can have in your ability. Think of it as LateUpdate() More...
 
virtual void PermitAbility (bool abilityPermitted)
 Changes the status of the ability's permission More...
 
virtual void Flip ()
 Override this to specify what should happen in this ability when the character flips More...
 
virtual void PlayAbilityStartFeedbacks ()
 Plays the ability start sound effect More...
 
virtual void StopStartFeedbacks ()
 Stops the ability used sound effect More...
 
virtual void PlayAbilityStopFeedbacks ()
 Plays the ability stop sound effect More...
 
virtual void RegisterAnimatorParameter (string parameterName, AnimatorControllerParameterType parameterType, out int parameter)
 Registers a new animator parameter to the list More...
 

Public Attributes

bool OnStairs = false
 true if the character is on stairs this frame, false otherwise More...
 
bool StairsBelow = false
 true if there are stairs below our character More...
 
bool StairsAhead = false
 true if there are stairs ahead of our character More...
 
bool ClimbingUpPrevented = false
 
Vector3 StairsAheadDetectionRaycastOrigin = new Vector3(-0.75f, 0f, 0f)
 the offset to apply when raycasting for stairs More...
 
float StairsAheadDetectionRaycastLength = 2f
 the length of the raycast looking for stairs More...
 
Vector3 StairsBelowDetectionRaycastOrigin = new Vector3(-0.2f, 0f, 0f)
 the offset to apply when raycasting for stairs More...
 
float StairsBelowDetectionRaycastLength = 0.25f
 the length of the raycast looking for stairs More...
 
float StairsBelowLockTime = 0.2f
 the duration, in seconds, during which collisions with one way platforms should be ignored when starting to get down a stair More...
 
float MinimumSpeedToBoardStairs = 0.1f
 the minimum horizontal speed at which the character must be moving to be able to start climbing stairs More...
 
bool PreventClimbingPastStairs = false
 
Vector3 PreventClimbingRaycastOffset = new Vector3(0.22f, 0.2f, 0f)
 the offset to apply to the character's position to determine the prevent climbing raycast's origin More...
 
float PreventClimbingRaycastLength = 0.5f
 the length of the raycast used to prevent climbing past stairs More...
 
- Public Attributes inherited from MoreMountains.CorgiEngine.CharacterAbility
MMFeedbacks AbilityStartFeedbacks
 the feedbacks to play when the ability starts More...
 
MMFeedbacks AbilityStopFeedbacks
 the feedbacks to play when the ability stops More...
 
bool AbilityPermitted = true
 if true, this ability can perform as usual, if not, it'll be ignored. You can use this to unlock abilities over time for example More...
 
CharacterStates.MovementStates[] BlockingMovementStates
 an array containing all the blocking movement states. If the Character is in one of these states and tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while Idle or Swimming, for example. More...
 
CharacterStates.CharacterConditions[] BlockingConditionStates
 an array containing all the blocking condition states. If the Character is in one of these states and tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while dead, for example. More...
 
Weapon.WeaponStates[] BlockingWeaponStates
 an array containing all the blocking weapon states. If one of the character's weapons is in one of these states and yet the character tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while attacking, for example. More...
 

Protected Member Functions

override void Initialization ()
 Initialization method More...
 
override void HandleInput ()
 Every frame, we check the input to see if we should initiate a stair climb More...
 
virtual void CheckPreventClimbing ()
 This methods casts a ray downwards, if needed, to check whether or not climbing up stairs should be prevented More...
 
virtual void HandleStairsAuthorization ()
 Sets the character in looking up state and asks the camera to look up More...
 
virtual void HandleEntryBounds ()
 Restores collisions once we're out of the stairs and if enough time has passed More...
 
virtual void AuthorizeStairs ()
 Authorizes collisions with stairs More...
 
virtual void DenyStairs ()
 Prevents collisions with stairs More...
 
virtual void CheckIfStairsAhead ()
 Casts a ray to see if there are stairs in front of the character More...
 
virtual void CheckIfStairsBelow ()
 Casts a ray to see if there are stairs below the character More...
 
virtual void CheckIfOnStairways ()
 Checks if the character is currently standing on stairs More...
 
override void InitializeAnimatorParameters ()
 Adds required animator parameters to the animator parameters list if they exist More...
 
- Protected Member Functions inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual void Start ()
 On Start(), we call the ability's intialization More...
 
virtual void InternalHandleInput ()
 Internal method to check if an input manager is present or not More...
 
virtual void OnRespawn ()
 Override this to describe what should happen to this ability when the character respawns More...
 
virtual void OnDeath ()
 Override this to describe what should happen to this ability when the character respawns More...
 
virtual void OnHit ()
 Override this to describe what should happen to this ability when the character takes a hit More...
 
virtual void OnEnable ()
 On enable, we bind our respawn delegate More...
 
virtual void OnDisable ()
 On disable, we unbind our respawn delegate More...
 

Protected Attributes

bool _stairsInputUp = false
 
bool _stairsInputDown = false
 
float _stairsAheadAngle
 
float _stairsBelowAngle
 
Vector3 _raycastOrigin
 
Vector3 _raycastDirection
 
Collider2D _goindDownEntryBoundsCollider
 
float _goindDownEntryAt
 
LayerMask _initialPlatformLayermask
 
int _stairsAnimationParameter
 
- Protected Attributes inherited from MoreMountains.CorgiEngine.CharacterAbility
Character _character
 
Transform _characterTransform
 
Health _health
 
CharacterHorizontalMovement _characterHorizontalMovement
 
CorgiController _controller
 
InputManager _inputManager
 
CameraController _sceneCamera
 
Animator _animator
 
CharacterStates _state
 
SpriteRenderer _spriteRenderer
 
MMStateMachine< CharacterStates.MovementStates_movement
 
MMStateMachine< CharacterStates.CharacterConditions_condition
 
bool _abilityInitialized = false
 
CharacterGravity _characterGravity
 
float _verticalInput
 
float _horizontalInput
 
bool _startFeedbackIsPlaying = false
 
List< CharacterHandleWeapon_handleWeaponList
 

Static Protected Attributes

const string _stairsAnimationParameterName = "OnStairs"
 

Additional Inherited Members

- Properties inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual bool AbilityAuthorized [get]
 
virtual bool AbilityInitialized [get]
 true if the ability has already been initialized More...
 

Detailed Description

Add this ability to a character and it'll be able to climb stairs Animation parameter : OnStairs, boolean

Member Function Documentation

◆ AuthorizeStairs()

virtual void MoreMountains.CorgiEngine.CharacterStairs.AuthorizeStairs ( )
protectedvirtual

Authorizes collisions with stairs

◆ CachePlatformMask()

virtual void MoreMountains.CorgiEngine.CharacterStairs.CachePlatformMask ( )
virtual

Stores the current controller platform mask

◆ CheckIfOnStairways()

virtual void MoreMountains.CorgiEngine.CharacterStairs.CheckIfOnStairways ( )
protectedvirtual

Checks if the character is currently standing on stairs

◆ CheckIfStairsAhead()

virtual void MoreMountains.CorgiEngine.CharacterStairs.CheckIfStairsAhead ( )
protectedvirtual

Casts a ray to see if there are stairs in front of the character

◆ CheckIfStairsBelow()

virtual void MoreMountains.CorgiEngine.CharacterStairs.CheckIfStairsBelow ( )
protectedvirtual

Casts a ray to see if there are stairs below the character

◆ CheckPreventClimbing()

virtual void MoreMountains.CorgiEngine.CharacterStairs.CheckPreventClimbing ( )
protectedvirtual

This methods casts a ray downwards, if needed, to check whether or not climbing up stairs should be prevented

◆ DenyStairs()

virtual void MoreMountains.CorgiEngine.CharacterStairs.DenyStairs ( )
protectedvirtual

Prevents collisions with stairs

◆ HandleEntryBounds()

virtual void MoreMountains.CorgiEngine.CharacterStairs.HandleEntryBounds ( )
protectedvirtual

Restores collisions once we're out of the stairs and if enough time has passed

◆ HandleInput()

override void MoreMountains.CorgiEngine.CharacterStairs.HandleInput ( )
protectedvirtual

Every frame, we check the input to see if we should initiate a stair climb

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ HandleStairsAuthorization()

virtual void MoreMountains.CorgiEngine.CharacterStairs.HandleStairsAuthorization ( )
protectedvirtual

Sets the character in looking up state and asks the camera to look up

◆ HelpBoxText()

override string MoreMountains.CorgiEngine.CharacterStairs.HelpBoxText ( )
virtual

This method is only used to display a helpbox text at the beginning of the ability's inspector.

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ Initialization()

override void MoreMountains.CorgiEngine.CharacterStairs.Initialization ( )
protectedvirtual

Initialization method

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ InitializeAnimatorParameters()

override void MoreMountains.CorgiEngine.CharacterStairs.InitializeAnimatorParameters ( )
protectedvirtual

Adds required animator parameters to the animator parameters list if they exist

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ ProcessAbility()

override void MoreMountains.CorgiEngine.CharacterStairs.ProcessAbility ( )
virtual

Every frame, we check for stairs in front and below the character, we handle input and decide whether or not we should climb stairs or go down them

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ ResetAbility()

override void MoreMountains.CorgiEngine.CharacterStairs.ResetAbility ( )
virtual

On reset ability, we cancel all the changes made

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ UpdateAnimator()

override void MoreMountains.CorgiEngine.CharacterStairs.UpdateAnimator ( )
virtual

At the end of the ability's cycle, we send our current crouching and crawling states to the animator

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

Member Data Documentation

◆ _goindDownEntryAt

float MoreMountains.CorgiEngine.CharacterStairs._goindDownEntryAt
protected

◆ _goindDownEntryBoundsCollider

Collider2D MoreMountains.CorgiEngine.CharacterStairs._goindDownEntryBoundsCollider
protected

◆ _initialPlatformLayermask

LayerMask MoreMountains.CorgiEngine.CharacterStairs._initialPlatformLayermask
protected

◆ _raycastDirection

Vector3 MoreMountains.CorgiEngine.CharacterStairs._raycastDirection
protected

◆ _raycastOrigin

Vector3 MoreMountains.CorgiEngine.CharacterStairs._raycastOrigin
protected

◆ _stairsAheadAngle

float MoreMountains.CorgiEngine.CharacterStairs._stairsAheadAngle
protected

◆ _stairsAnimationParameter

int MoreMountains.CorgiEngine.CharacterStairs._stairsAnimationParameter
protected

◆ _stairsAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterStairs._stairsAnimationParameterName = "OnStairs"
staticprotected

◆ _stairsBelowAngle

float MoreMountains.CorgiEngine.CharacterStairs._stairsBelowAngle
protected

◆ _stairsInputDown

bool MoreMountains.CorgiEngine.CharacterStairs._stairsInputDown = false
protected

◆ _stairsInputUp

bool MoreMountains.CorgiEngine.CharacterStairs._stairsInputUp = false
protected

◆ ClimbingUpPrevented

bool MoreMountains.CorgiEngine.CharacterStairs.ClimbingUpPrevented = false

◆ MinimumSpeedToBoardStairs

float MoreMountains.CorgiEngine.CharacterStairs.MinimumSpeedToBoardStairs = 0.1f

the minimum horizontal speed at which the character must be moving to be able to start climbing stairs

◆ OnStairs

bool MoreMountains.CorgiEngine.CharacterStairs.OnStairs = false

true if the character is on stairs this frame, false otherwise

◆ PreventClimbingPastStairs

bool MoreMountains.CorgiEngine.CharacterStairs.PreventClimbingPastStairs = false

if this is true, a ray will be cast downwards from PreventClimbingRaycastOffset, for PreventClimbingRaycastLength if that ray hits stairs, you won't be able to get up on them. usually you'll want to position this ray's origin just in front of your character's head, and have it be slightly shorter than your character's height

◆ PreventClimbingRaycastLength

float MoreMountains.CorgiEngine.CharacterStairs.PreventClimbingRaycastLength = 0.5f

the length of the raycast used to prevent climbing past stairs

◆ PreventClimbingRaycastOffset

Vector3 MoreMountains.CorgiEngine.CharacterStairs.PreventClimbingRaycastOffset = new Vector3(0.22f, 0.2f, 0f)

the offset to apply to the character's position to determine the prevent climbing raycast's origin

◆ StairsAhead

bool MoreMountains.CorgiEngine.CharacterStairs.StairsAhead = false

true if there are stairs ahead of our character

◆ StairsAheadDetectionRaycastLength

float MoreMountains.CorgiEngine.CharacterStairs.StairsAheadDetectionRaycastLength = 2f

the length of the raycast looking for stairs

◆ StairsAheadDetectionRaycastOrigin

Vector3 MoreMountains.CorgiEngine.CharacterStairs.StairsAheadDetectionRaycastOrigin = new Vector3(-0.75f, 0f, 0f)

the offset to apply when raycasting for stairs

◆ StairsBelow

bool MoreMountains.CorgiEngine.CharacterStairs.StairsBelow = false

true if there are stairs below our character

◆ StairsBelowDetectionRaycastLength

float MoreMountains.CorgiEngine.CharacterStairs.StairsBelowDetectionRaycastLength = 0.25f

the length of the raycast looking for stairs

◆ StairsBelowDetectionRaycastOrigin

Vector3 MoreMountains.CorgiEngine.CharacterStairs.StairsBelowDetectionRaycastOrigin = new Vector3(-0.2f, 0f, 0f)

the offset to apply when raycasting for stairs

◆ StairsBelowLockTime

float MoreMountains.CorgiEngine.CharacterStairs.StairsBelowLockTime = 0.2f

the duration, in seconds, during which collisions with one way platforms should be ignored when starting to get down a stair


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