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

Add this class to a character and it'll be able to perform a horizontal dash Animator parameters : Dashing More...

Inheritance diagram for MoreMountains.CorgiEngine.CharacterDash:
MoreMountains.CorgiEngine.CharacterAbility MoreMountains.CorgiEngine.CorgiMonoBehaviour MoreMountains.CorgiEngine.CharacterDamageDash

Public Types

enum  SuccessiveDashResetMethods { SuccessiveDashResetMethods.Grounded, SuccessiveDashResetMethods.Time }
 

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 ()
 The second of the 3 passes you can have in your ability. Think of it as Update() More...
 
virtual void StartDash ()
 Causes the character to dash or dive (depending on the vertical movement at the start of the dash) More...
 
virtual bool DashConditions ()
 This method evaluates the internal conditions for a dash (cooldown between dashes, amount of dashes left) and returns true if a dash can be performed, false otherwise More...
 
virtual void SetSuccessiveDashesLeft (int newAmount)
 A method to reset the amount of successive dashes left More...
 
virtual bool DashAuthorized ()
 This method evaluates the external conditions (state, other abilities) for a dash, and returns true if a dash can be performed, false otherwise More...
 
virtual void InitiateDash ()
 initializes all parameters prior to a dash and triggers the pre dash feedbacks More...
 
virtual void StopDash ()
 Stops the dash coroutine and resets all necessary parts of the character More...
 
override void UpdateAnimator ()
 At the end of the cycle, we update our animator's Dashing state 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

float DashDistance = 3f
 the distance this dash should cover More...
 
float DashForce = 40f
 the force of the dash More...
 
bool ResetForcesOnExit = false
 if this is true, forces will be reset on dash exit (killing inertia) More...
 
bool ForceExactDistance = false
 if this is true, position will be forced on exit to match an exact distance More...
 
bool DetachFromMovingPlatformsOnDash = false
 if this is true, the character's controller will detach from moving platforms when dash starts More...
 
MMAim Aim
 the dash's aim properties More...
 
float MinimumInputThreshold = 0.1f
 the minimum amount of input required to apply a direction to the dash More...
 
bool FlipCharacterIfNeeded = true
 if this is true, the character will flip when dashing and facing the dash's opposite direction More...
 
bool AutoCorrectTrajectory = true
 if this is true, will prevent the character from dashing into the ground when already grounded More...
 
float DashDirectionMinThreshold = 0.1f
 the direction threshold over which to compare direction when authorizing the dash. You'll likely want to keep it fairly close to zero More...
 
float DashCooldown = 1f
 the duration of the cooldown between 2 dashes (in seconds) More...
 
bool LimitedDashes = false
 whether or not dashes can be performed infinitely More...
 
int SuccessiveDashAmount = 1
 the amount of successive dashes a character can perform, only if dashes are not infinite More...
 
int SuccessiveDashesLeft = 1
 the amount of dashes left (runtime value only), only if dashes are not infinite More...
 
SuccessiveDashResetMethods SuccessiveDashResetMethod = SuccessiveDashResetMethods.Grounded
 the method used to reset the number of dashes left, only if dashes are not infinite More...
 
float SuccessiveDashResetDuration = 2f
 when in time reset mode, the duration, in seconds, after which the amount of dashes left gets reset, only if dashes are not infinite More...
 
bool InvincibleWhileDashing = false
 if this is true, this character won't receive any damage while a dash is in progress 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 ()
 Initializes our aim instance More...
 
override void HandleInput ()
 At the start of each cycle, we check if we're pressing the dash button. If we More...
 
virtual void HandleAmountOfDashesLeft ()
 Checks if conditions are met to reset the amount of dashes left More...
 
virtual void ComputeDashDirection ()
 Computes the dash direction based on the selected options More...
 
virtual void CheckAutoCorrectTrajectory ()
 Prevents the character from dashing into the ground when already grounded and if AutoCorrectTrajectory is checked More...
 
virtual void CheckFlipCharacter ()
 Checks whether or not a character flip is required, and flips the character if needed More...
 
virtual IEnumerator Dash ()
 Coroutine used to move the player in a direction over time More...
 
virtual bool TestForLevelBounds ()
 If the character is hitting level bounds, we check if they're "in front" of us or "behind" us, and whether it should prevent the dash or not More...
 
virtual bool TestForExactDistance ()
 Checks (if needed) if we've exceeded our distance, and positions the character at the exact final position 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

float _cooldownTimeStamp = 0
 
float _startTime
 
Vector2 _initialPosition
 
Vector2 _dashDirection
 
float _distanceTraveled = 0f
 
bool _shouldKeepDashing = true
 
float _slopeAngleSave = 0f
 
bool _dashEndedNaturally = true
 
IEnumerator _dashCoroutine
 
CharacterDive _characterDive
 
float _lastDashAt = 0f
 
float _averageDistancePerFrame
 
int _startFrame
 
Bounds _bounds
 
int _dashingAnimationParameter
 
- 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 _dashingAnimationParameterName = "Dashing"
 

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 class to a character and it'll be able to perform a horizontal dash Animator parameters : Dashing

Member Enumeration Documentation

◆ SuccessiveDashResetMethods

Member Function Documentation

◆ CheckAutoCorrectTrajectory()

virtual void MoreMountains.CorgiEngine.CharacterDash.CheckAutoCorrectTrajectory ( )
protectedvirtual

Prevents the character from dashing into the ground when already grounded and if AutoCorrectTrajectory is checked

◆ CheckFlipCharacter()

virtual void MoreMountains.CorgiEngine.CharacterDash.CheckFlipCharacter ( )
protectedvirtual

Checks whether or not a character flip is required, and flips the character if needed

◆ ComputeDashDirection()

virtual void MoreMountains.CorgiEngine.CharacterDash.ComputeDashDirection ( )
protectedvirtual

Computes the dash direction based on the selected options

◆ Dash()

virtual IEnumerator MoreMountains.CorgiEngine.CharacterDash.Dash ( )
protectedvirtual

Coroutine used to move the player in a direction over time

◆ DashAuthorized()

virtual bool MoreMountains.CorgiEngine.CharacterDash.DashAuthorized ( )
virtual

This method evaluates the external conditions (state, other abilities) for a dash, and returns true if a dash can be performed, false otherwise

Returns

◆ DashConditions()

virtual bool MoreMountains.CorgiEngine.CharacterDash.DashConditions ( )
virtual

This method evaluates the internal conditions for a dash (cooldown between dashes, amount of dashes left) and returns true if a dash can be performed, false otherwise

Returns

◆ HandleAmountOfDashesLeft()

virtual void MoreMountains.CorgiEngine.CharacterDash.HandleAmountOfDashesLeft ( )
protectedvirtual

Checks if conditions are met to reset the amount of dashes left

◆ HandleInput()

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

At the start of each cycle, we check if we're pressing the dash button. If we

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ HelpBoxText()

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

Initializes our aim instance

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ InitializeAnimatorParameters()

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

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

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ InitiateDash()

virtual void MoreMountains.CorgiEngine.CharacterDash.InitiateDash ( )
virtual

initializes all parameters prior to a dash and triggers the pre dash feedbacks

Reimplemented in MoreMountains.CorgiEngine.CharacterDamageDash.

◆ ProcessAbility()

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

The second of the 3 passes you can have in your ability. Think of it as Update()

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ ResetAbility()

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

On reset ability, we cancel all the changes made

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ SetSuccessiveDashesLeft()

virtual void MoreMountains.CorgiEngine.CharacterDash.SetSuccessiveDashesLeft ( int  newAmount)
virtual

A method to reset the amount of successive dashes left

Parameters
newAmount

◆ StartDash()

virtual void MoreMountains.CorgiEngine.CharacterDash.StartDash ( )
virtual

Causes the character to dash or dive (depending on the vertical movement at the start of the dash)

◆ StopDash()

virtual void MoreMountains.CorgiEngine.CharacterDash.StopDash ( )
virtual

Stops the dash coroutine and resets all necessary parts of the character

Reimplemented in MoreMountains.CorgiEngine.CharacterDamageDash.

◆ TestForExactDistance()

virtual bool MoreMountains.CorgiEngine.CharacterDash.TestForExactDistance ( )
protectedvirtual

Checks (if needed) if we've exceeded our distance, and positions the character at the exact final position

Returns

◆ TestForLevelBounds()

virtual bool MoreMountains.CorgiEngine.CharacterDash.TestForLevelBounds ( )
protectedvirtual

If the character is hitting level bounds, we check if they're "in front" of us or "behind" us, and whether it should prevent the dash or not

Returns

◆ UpdateAnimator()

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

At the end of the cycle, we update our animator's Dashing state

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

Member Data Documentation

◆ _averageDistancePerFrame

float MoreMountains.CorgiEngine.CharacterDash._averageDistancePerFrame
protected

◆ _bounds

Bounds MoreMountains.CorgiEngine.CharacterDash._bounds
protected

◆ _characterDive

CharacterDive MoreMountains.CorgiEngine.CharacterDash._characterDive
protected

◆ _cooldownTimeStamp

float MoreMountains.CorgiEngine.CharacterDash._cooldownTimeStamp = 0
protected

◆ _dashCoroutine

IEnumerator MoreMountains.CorgiEngine.CharacterDash._dashCoroutine
protected

◆ _dashDirection

Vector2 MoreMountains.CorgiEngine.CharacterDash._dashDirection
protected

◆ _dashEndedNaturally

bool MoreMountains.CorgiEngine.CharacterDash._dashEndedNaturally = true
protected

◆ _dashingAnimationParameter

int MoreMountains.CorgiEngine.CharacterDash._dashingAnimationParameter
protected

◆ _dashingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterDash._dashingAnimationParameterName = "Dashing"
staticprotected

◆ _distanceTraveled

float MoreMountains.CorgiEngine.CharacterDash._distanceTraveled = 0f
protected

◆ _initialPosition

Vector2 MoreMountains.CorgiEngine.CharacterDash._initialPosition
protected

◆ _lastDashAt

float MoreMountains.CorgiEngine.CharacterDash._lastDashAt = 0f
protected

◆ _shouldKeepDashing

bool MoreMountains.CorgiEngine.CharacterDash._shouldKeepDashing = true
protected

◆ _slopeAngleSave

float MoreMountains.CorgiEngine.CharacterDash._slopeAngleSave = 0f
protected

◆ _startFrame

int MoreMountains.CorgiEngine.CharacterDash._startFrame
protected

◆ _startTime

float MoreMountains.CorgiEngine.CharacterDash._startTime
protected

◆ Aim

MMAim MoreMountains.CorgiEngine.CharacterDash.Aim

the dash's aim properties

◆ AutoCorrectTrajectory

bool MoreMountains.CorgiEngine.CharacterDash.AutoCorrectTrajectory = true

if this is true, will prevent the character from dashing into the ground when already grounded

◆ DashCooldown

float MoreMountains.CorgiEngine.CharacterDash.DashCooldown = 1f

the duration of the cooldown between 2 dashes (in seconds)

◆ DashDirectionMinThreshold

float MoreMountains.CorgiEngine.CharacterDash.DashDirectionMinThreshold = 0.1f

the direction threshold over which to compare direction when authorizing the dash. You'll likely want to keep it fairly close to zero

◆ DashDistance

float MoreMountains.CorgiEngine.CharacterDash.DashDistance = 3f

the distance this dash should cover

◆ DashForce

float MoreMountains.CorgiEngine.CharacterDash.DashForce = 40f

the force of the dash

◆ DetachFromMovingPlatformsOnDash

bool MoreMountains.CorgiEngine.CharacterDash.DetachFromMovingPlatformsOnDash = false

if this is true, the character's controller will detach from moving platforms when dash starts

◆ FlipCharacterIfNeeded

bool MoreMountains.CorgiEngine.CharacterDash.FlipCharacterIfNeeded = true

if this is true, the character will flip when dashing and facing the dash's opposite direction

◆ ForceExactDistance

bool MoreMountains.CorgiEngine.CharacterDash.ForceExactDistance = false

if this is true, position will be forced on exit to match an exact distance

◆ InvincibleWhileDashing

bool MoreMountains.CorgiEngine.CharacterDash.InvincibleWhileDashing = false

if this is true, this character won't receive any damage while a dash is in progress

◆ LimitedDashes

bool MoreMountains.CorgiEngine.CharacterDash.LimitedDashes = false

whether or not dashes can be performed infinitely

◆ MinimumInputThreshold

float MoreMountains.CorgiEngine.CharacterDash.MinimumInputThreshold = 0.1f

the minimum amount of input required to apply a direction to the dash

◆ ResetForcesOnExit

bool MoreMountains.CorgiEngine.CharacterDash.ResetForcesOnExit = false

if this is true, forces will be reset on dash exit (killing inertia)

◆ SuccessiveDashAmount

int MoreMountains.CorgiEngine.CharacterDash.SuccessiveDashAmount = 1

the amount of successive dashes a character can perform, only if dashes are not infinite

◆ SuccessiveDashesLeft

int MoreMountains.CorgiEngine.CharacterDash.SuccessiveDashesLeft = 1

the amount of dashes left (runtime value only), only if dashes are not infinite

◆ SuccessiveDashResetDuration

float MoreMountains.CorgiEngine.CharacterDash.SuccessiveDashResetDuration = 2f

when in time reset mode, the duration, in seconds, after which the amount of dashes left gets reset, only if dashes are not infinite

◆ SuccessiveDashResetMethod

SuccessiveDashResetMethods MoreMountains.CorgiEngine.CharacterDash.SuccessiveDashResetMethod = SuccessiveDashResetMethods.Grounded

the method used to reset the number of dashes left, only if dashes are not infinite


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