Corgi Engine  v9.1
MoreMountains.CorgiEngine.CharacterCrouch Class Reference

Add this component to a character and it'll be able to crouch and crawl Animator parameters : Crouching, Crawling More...

Inheritance diagram for MoreMountains.CorgiEngine.CharacterCrouch:
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...
 
override void ProcessAbility ()
 Every frame, we check if we're crouched and if we still should be More...
 
virtual void Crouch ()
 If we're pressing down, we check if we can crouch or crawl, and change states accordingly More...
 
virtual void ExitCrouch ()
 Exits the crouched state 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 CrawlAuthorized = true
 if this is set to false, the character won't be able to crawl, just to crouch More...
 
float CrawlSpeed = 4f
 the speed of the character when it's crouching More...
 
bool InputDriven = true
 if this is true, this ability will be input driven. set this to false to use it on an AI, or any other script driven agent More...
 
bool ResizeColliderWhenCrouched = false
 if this is true, the collider will be resized when crouched More...
 
Vector2 CrouchedBoxColliderSize = new Vector2(1,1)
 
bool CanCrouchWhileMoving = true
 if this is false, the character will have to stop moving to start crouching More...
 
bool CanMoveWhileCrouching = true
 if this is false, the character won't be able to move while crouching More...
 
bool InATunnel
 if this is true, the character is crouched and has an obstacle over its head that prevents it from getting back up again More...
 
bool MoveCameraTarget = true
 Whether or not to move the camera target, that will be used as the focus point for the Cinemachine virtual camera. More...
 
Vector3 CameraTargetOffset = new Vector3(0f, -3f, 0f)
 the offset to apply to the camera target 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 ()
 On Start(), we set our tunnel flag to false More...
 
override void HandleInput ()
 At the start of the ability's cycle, we check if we're pressing down. If yes, we call Crouch() More...
 
virtual void DetermineState ()
 Runs every frame to check if we should switch from crouching to crawling or the other way around More...
 
virtual void CheckExitCrouch ()
 Every frame, we check to see if we should exit the Crouching (or Crawling) state More...
 
override void InitializeAnimatorParameters ()
 Adds required animator parameters to the animator parameters list if they exist More...
 
virtual void RecalculateRays ()
 Recalculates the raycast's origin points. 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

int _crouchingAnimationParameter
 
int _crawlingAnimationParameter
 
bool _wasInATunnelLastFrame
 
bool _crouching = false
 
bool _airborneLastFrame = false
 
bool _appliedMovementMultiplier = false
 
- 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 _crouchingAnimationParameterName = "Crouching"
 
const string _crawlingAnimationParameterName = "Crawling"
 

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 component to a character and it'll be able to crouch and crawl Animator parameters : Crouching, Crawling

Member Function Documentation

◆ CheckExitCrouch()

virtual void MoreMountains.CorgiEngine.CharacterCrouch.CheckExitCrouch ( )
protectedvirtual

Every frame, we check to see if we should exit the Crouching (or Crawling) state

◆ Crouch()

virtual void MoreMountains.CorgiEngine.CharacterCrouch.Crouch ( )
virtual

If we're pressing down, we check if we can crouch or crawl, and change states accordingly

◆ DetermineState()

virtual void MoreMountains.CorgiEngine.CharacterCrouch.DetermineState ( )
protectedvirtual

Runs every frame to check if we should switch from crouching to crawling or the other way around

◆ ExitCrouch()

virtual void MoreMountains.CorgiEngine.CharacterCrouch.ExitCrouch ( )
virtual

Exits the crouched state

◆ HandleInput()

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

At the start of the ability's cycle, we check if we're pressing down. If yes, we call Crouch()

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ HelpBoxText()

override string MoreMountains.CorgiEngine.CharacterCrouch.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.CharacterCrouch.Initialization ( )
protectedvirtual

On Start(), we set our tunnel flag to false

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ InitializeAnimatorParameters()

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

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

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ ProcessAbility()

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

Every frame, we check if we're crouched and if we still should be

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ RecalculateRays()

virtual void MoreMountains.CorgiEngine.CharacterCrouch.RecalculateRays ( )
protectedvirtual

Recalculates the raycast's origin points.

◆ ResetAbility()

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

On reset ability, we cancel all the changes made

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ UpdateAnimator()

override void MoreMountains.CorgiEngine.CharacterCrouch.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

◆ _airborneLastFrame

bool MoreMountains.CorgiEngine.CharacterCrouch._airborneLastFrame = false
protected

◆ _appliedMovementMultiplier

bool MoreMountains.CorgiEngine.CharacterCrouch._appliedMovementMultiplier = false
protected

◆ _crawlingAnimationParameter

int MoreMountains.CorgiEngine.CharacterCrouch._crawlingAnimationParameter
protected

◆ _crawlingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterCrouch._crawlingAnimationParameterName = "Crawling"
staticprotected

◆ _crouching

bool MoreMountains.CorgiEngine.CharacterCrouch._crouching = false
protected

◆ _crouchingAnimationParameter

int MoreMountains.CorgiEngine.CharacterCrouch._crouchingAnimationParameter
protected

◆ _crouchingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterCrouch._crouchingAnimationParameterName = "Crouching"
staticprotected

◆ _wasInATunnelLastFrame

bool MoreMountains.CorgiEngine.CharacterCrouch._wasInATunnelLastFrame
protected

◆ CameraTargetOffset

Vector3 MoreMountains.CorgiEngine.CharacterCrouch.CameraTargetOffset = new Vector3(0f, -3f, 0f)

the offset to apply to the camera target

◆ CanCrouchWhileMoving

bool MoreMountains.CorgiEngine.CharacterCrouch.CanCrouchWhileMoving = true

if this is false, the character will have to stop moving to start crouching

◆ CanMoveWhileCrouching

bool MoreMountains.CorgiEngine.CharacterCrouch.CanMoveWhileCrouching = true

if this is false, the character won't be able to move while crouching

◆ CrawlAuthorized

bool MoreMountains.CorgiEngine.CharacterCrouch.CrawlAuthorized = true

if this is set to false, the character won't be able to crawl, just to crouch

◆ CrawlSpeed

float MoreMountains.CorgiEngine.CharacterCrouch.CrawlSpeed = 4f

the speed of the character when it's crouching

◆ CrouchedBoxColliderSize

Vector2 MoreMountains.CorgiEngine.CharacterCrouch.CrouchedBoxColliderSize = new Vector2(1,1)

the size to apply to the collider when crouched (if ResizeColliderWhenCrouched is true, otherwise this will be ignored) note that changing the width of your collider when crouching will likely result in glitches when initiating a crouch on a slope, it's best not to change it

◆ InATunnel

bool MoreMountains.CorgiEngine.CharacterCrouch.InATunnel

if this is true, the character is crouched and has an obstacle over its head that prevents it from getting back up again

◆ InputDriven

bool MoreMountains.CorgiEngine.CharacterCrouch.InputDriven = true

if this is true, this ability will be input driven. set this to false to use it on an AI, or any other script driven agent

◆ MoveCameraTarget

bool MoreMountains.CorgiEngine.CharacterCrouch.MoveCameraTarget = true

Whether or not to move the camera target, that will be used as the focus point for the Cinemachine virtual camera.

◆ ResizeColliderWhenCrouched

bool MoreMountains.CorgiEngine.CharacterCrouch.ResizeColliderWhenCrouched = false

if this is true, the collider will be resized when crouched


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