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

Add this class to a character and it'll be able to "roll" along surfaces, with options to go through enemies, and keep controlling direction Animator parameters : Rolling, StartedRolling More...

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

Public Types

enum  SuccessiveRollsResetMethods { SuccessiveRollsResetMethods.Grounded, SuccessiveRollsResetMethods.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 StartRoll ()
 Causes the character to roll or dive (depending on the vertical movement at the start of the roll) More...
 
virtual bool RollConditions ()
 This method evaluates the internal conditions for a roll (cooldown between rolls, amount of rolls left) and returns true if a roll can be performed, false otherwise More...
 
virtual void SetSuccessiveRollsLeft (int newAmount)
 A method to reset the amount of successive rolls left More...
 
virtual bool RollAuthorized ()
 This method evaluates the external conditions (state, other abilities) for a roll, and returns true if a roll can be performed, false otherwise More...
 
virtual void InitiateRoll ()
 initializes all parameters prior to a roll and triggers the pre roll feedbacks More...
 
virtual void StopRoll ()
 Stops the roll coroutine and resets all necessary parts of the character More...
 
override void UpdateAnimator ()
 At the end of the cycle, we update our animator's Rolling 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 RollDuration = 0.5f
 the duration of the roll, in seconds More...
 
float RollSpeed = 3f
 the speed of the roll (a multiplier of the regular walk speed) More...
 
bool BlockHorizontalInput = false
 if this is true, horizontal input won't be read, and the character won't be able to change direction during a roll More...
 
bool PreventDamageCollisionsDuringRoll = false
 if this is true, no damage will be applied during the roll, and the character will be able to go through enemies More...
 
MMAim Aim
 the roll's aim properties More...
 
float MinimumInputThreshold = 0.1f
 the minimum amount of input required to apply a direction to the roll More...
 
bool FlipCharacterIfNeeded = true
 if this is true, the character will flip when rolling and facing the roll's opposite direction More...
 
float RollCooldown = 1f
 the duration of the cooldown between 2 rolls (in seconds) More...
 
bool LimitedRolls = false
 whether or not rolls can be performed infinitely More...
 
int SuccessiveRollsAmount = 1
 the amount of successive rolls a character can perform, only if rolls are not infinite More...
 
int SuccessiveRollsLeft = 1
 the amount of rollss left (runtime value only), only if rolls are not infinite More...
 
float SuccessiveRollsResetDuration = 2f
 when in time reset mode, the duration, in seconds, after which the amount of rolls left gets reset, only if rolls are not infinite 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 roll button. If we More...
 
virtual void HandleAmountOfRollsLeft ()
 Checks if conditions are met to reset the amount of rolls left More...
 
virtual void ComputeRollDirection ()
 Computes the roll direction based on the selected options More...
 
virtual void CheckFlipCharacter ()
 Checks whether or not a character flip is required, and flips the character if needed More...
 
virtual IEnumerator RollCoroutine ()
 Coroutine used to move the player in a direction over time 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
 
Vector2 _rollDirection
 
bool _shouldKeepRolling = true
 
IEnumerator _rollCoroutine
 
float _lastRollAt = 0f
 
float _currentDirection
 
float _drivenInput
 
float _originalMultiplier = 1f
 
bool _originalInvulnerability = true
 
int _rollingAnimationParameter
 
int _startedRollingAnimationParameter
 
- 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 _rollingAnimationParameterName = "Rolling"
 
const string _startedRollingAnimationParameterName = "StartedRolling"
 

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 "roll" along surfaces, with options to go through enemies, and keep controlling direction Animator parameters : Rolling, StartedRolling

Member Enumeration Documentation

◆ SuccessiveRollsResetMethods

Member Function Documentation

◆ CheckFlipCharacter()

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

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

◆ ComputeRollDirection()

virtual void MoreMountains.CorgiEngine.CharacterRoll.ComputeRollDirection ( )
protectedvirtual

Computes the roll direction based on the selected options

◆ HandleAmountOfRollsLeft()

virtual void MoreMountains.CorgiEngine.CharacterRoll.HandleAmountOfRollsLeft ( )
protectedvirtual

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

◆ HandleInput()

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

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

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ HelpBoxText()

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

Initializes our aim instance

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ InitializeAnimatorParameters()

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

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

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ InitiateRoll()

virtual void MoreMountains.CorgiEngine.CharacterRoll.InitiateRoll ( )
virtual

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

◆ ProcessAbility()

override void MoreMountains.CorgiEngine.CharacterRoll.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.CharacterRoll.ResetAbility ( )
virtual

On reset ability, we cancel all the changes made

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ RollAuthorized()

virtual bool MoreMountains.CorgiEngine.CharacterRoll.RollAuthorized ( )
virtual

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

Returns

◆ RollConditions()

virtual bool MoreMountains.CorgiEngine.CharacterRoll.RollConditions ( )
virtual

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

Returns

◆ RollCoroutine()

virtual IEnumerator MoreMountains.CorgiEngine.CharacterRoll.RollCoroutine ( )
protectedvirtual

Coroutine used to move the player in a direction over time

◆ SetSuccessiveRollsLeft()

virtual void MoreMountains.CorgiEngine.CharacterRoll.SetSuccessiveRollsLeft ( int  newAmount)
virtual

A method to reset the amount of successive rolls left

Parameters
newAmount

◆ StartRoll()

virtual void MoreMountains.CorgiEngine.CharacterRoll.StartRoll ( )
virtual

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

◆ StopRoll()

virtual void MoreMountains.CorgiEngine.CharacterRoll.StopRoll ( )
virtual

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

◆ UpdateAnimator()

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

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

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

Member Data Documentation

◆ _cooldownTimeStamp

float MoreMountains.CorgiEngine.CharacterRoll._cooldownTimeStamp = 0
protected

◆ _currentDirection

float MoreMountains.CorgiEngine.CharacterRoll._currentDirection
protected

◆ _drivenInput

float MoreMountains.CorgiEngine.CharacterRoll._drivenInput
protected

◆ _lastRollAt

float MoreMountains.CorgiEngine.CharacterRoll._lastRollAt = 0f
protected

◆ _originalInvulnerability

bool MoreMountains.CorgiEngine.CharacterRoll._originalInvulnerability = true
protected

◆ _originalMultiplier

float MoreMountains.CorgiEngine.CharacterRoll._originalMultiplier = 1f
protected

◆ _rollCoroutine

IEnumerator MoreMountains.CorgiEngine.CharacterRoll._rollCoroutine
protected

◆ _rollDirection

Vector2 MoreMountains.CorgiEngine.CharacterRoll._rollDirection
protected

◆ _rollingAnimationParameter

int MoreMountains.CorgiEngine.CharacterRoll._rollingAnimationParameter
protected

◆ _rollingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterRoll._rollingAnimationParameterName = "Rolling"
staticprotected

◆ _shouldKeepRolling

bool MoreMountains.CorgiEngine.CharacterRoll._shouldKeepRolling = true
protected

◆ _startedRollingAnimationParameter

int MoreMountains.CorgiEngine.CharacterRoll._startedRollingAnimationParameter
protected

◆ _startedRollingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterRoll._startedRollingAnimationParameterName = "StartedRolling"
staticprotected

◆ Aim

MMAim MoreMountains.CorgiEngine.CharacterRoll.Aim

the roll's aim properties

◆ BlockHorizontalInput

bool MoreMountains.CorgiEngine.CharacterRoll.BlockHorizontalInput = false

if this is true, horizontal input won't be read, and the character won't be able to change direction during a roll

◆ FlipCharacterIfNeeded

bool MoreMountains.CorgiEngine.CharacterRoll.FlipCharacterIfNeeded = true

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

◆ LimitedRolls

bool MoreMountains.CorgiEngine.CharacterRoll.LimitedRolls = false

whether or not rolls can be performed infinitely

◆ MinimumInputThreshold

float MoreMountains.CorgiEngine.CharacterRoll.MinimumInputThreshold = 0.1f

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

◆ PreventDamageCollisionsDuringRoll

bool MoreMountains.CorgiEngine.CharacterRoll.PreventDamageCollisionsDuringRoll = false

if this is true, no damage will be applied during the roll, and the character will be able to go through enemies

◆ RollCooldown

float MoreMountains.CorgiEngine.CharacterRoll.RollCooldown = 1f

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

◆ RollDuration

float MoreMountains.CorgiEngine.CharacterRoll.RollDuration = 0.5f

the duration of the roll, in seconds

◆ RollSpeed

float MoreMountains.CorgiEngine.CharacterRoll.RollSpeed = 3f

the speed of the roll (a multiplier of the regular walk speed)

◆ SuccessiveRollsAmount

int MoreMountains.CorgiEngine.CharacterRoll.SuccessiveRollsAmount = 1

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

◆ SuccessiveRollsLeft

int MoreMountains.CorgiEngine.CharacterRoll.SuccessiveRollsLeft = 1

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

◆ SuccessiveRollsResetDuration

float MoreMountains.CorgiEngine.CharacterRoll.SuccessiveRollsResetDuration = 2f

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


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