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

Add this class to a character and it'll be able to jump Animator parameters : Jumping (bool), DoubleJumping (bool), HitTheGround (bool) More...

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

Public Types

enum  JumpBehavior {
  JumpBehavior.CanJumpOnGround, JumpBehavior.CanJumpOnGroundAndFromLadders, JumpBehavior.CanJumpAnywhere, JumpBehavior.CantJump,
  JumpBehavior.CanJumpAnywhereAnyNumberOfTimes
}
 the possible jump restrictions More...
 

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 perform a number of checks related to jump More...
 
virtual void JumpStart ()
 Causes the character to start jumping. More...
 
virtual void SetCanJumpStop (bool status)
 Use this method, from any class, to prevent the current jump from being proportional (releasing won't cancel the jump/current momentum) More...
 
virtual bool JumpDownFromOneWayPlatform ()
 Handles jumping down from a one way platform. More...
 
virtual void JumpStop ()
 Causes the character to stop jumping. More...
 
virtual void ResetNumberOfJumps ()
 Resets the number of jumps. More...
 
virtual void SetJumpFlags ()
 Resets jump flags More...
 
virtual void SetNumberOfJumpsLeft (int newNumberOfJumps)
 Sets the number of jumps left. More...
 
virtual void ResetJumpButtonReleased ()
 Resets the jump button released flag. More...
 
override void UpdateAnimator ()
 At the end of each cycle, sends Jumping states to the Character's animator More...
 
override void ResetAbility ()
 Resets parameters in anticipation for the Character's respawn. 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

int NumberOfJumps = 2
 the maximum number of jumps allowed (0 : no jump, 1 : normal jump, 2 : double jump, etc...) More...
 
float JumpHeight = 3.025f
 defines how high the character can jump More...
 
JumpBehavior JumpRestrictions = JumpBehavior.CanJumpAnywhere
 basic rules for jumps : where can the player jump ? More...
 
bool ResetCameraOffsetOnJump = false
 if this is true, camera offset will be reset on jump More...
 
bool CanJumpDownOneWayPlatforms = true
 if this is true, this character can jump down one way platforms by doing down + jump More...
 
bool FixedAerialJumpCount = false
 deducts an additional jump if the sequence begins in the air. This keeps aerial jump count consistent regardless of whether the first jump began in the air or on the ground. More...
 
bool JumpIsProportionalToThePressTime = true
 if true, the jump duration/height will be proportional to the duration of the button's press More...
 
float JumpMinimumAirTime = 0.1f
 the minimum time in the air allowed when jumping - this is used for pressure controlled jumps More...
 
float JumpReleaseForceFactor = 2f
 the amount by which we'll modify the current speed when the jump button gets released More...
 
float CoyoteTime = 0f
 a timeframe during which, after leaving the ground, the character can still trigger a jump More...
 
float InputBufferDuration = 0f
 if the character lands, and the jump button's been pressed during that InputBufferDuration, a new jump will be triggered More...
 
float OneWayPlatformsJumpCollisionOffDuration = 0.3f
 duration (in seconds) we need to disable collisions when jumping down a 1 way platform More...
 
float MovingPlatformsJumpCollisionOffDuration = 0.05f
 duration (in seconds) we need to disable collisions when jumping off a moving platform More...
 
MMFeedbacks AirJumpFeedbacks
 the MMFeedbacks to play when jumping in the air More...
 
MMFeedbacks DoubleJumpFeedbacks
 the MMFeedbacks to play when double jumping More...
 
int NumberOfJumpsLeft
 the number of jumps left to the character 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 reset our number of jumps More...
 
virtual void ResetInitialNumberOfJumps ()
 Stores the current NumberOfJumps More...
 
override void HandleInput ()
 At the beginning of each cycle we check if we've just pressed or released the jump button More...
 
virtual void HandlePreventedJump ()
 Checks if the character is still grounded after a jump, potentially prevented by reset forces by another ability / weapon More...
 
virtual bool EvaluateJumpTimeWindow ()
 Determines if whether or not a Character is still in its Jump Window (the delay during which, after falling off a cliff, a jump is still possible without requiring multiple jumps) More...
 
virtual bool EvaluateJumpConditions ()
 Evaluates the jump conditions to determine whether or not a jump can occur More...
 
virtual void JumpFromMovingPlatform ()
 Handles jumping from a moving platform. More...
 
virtual void UpdateController ()
 Updates the controller state based on our current jumping state 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 _jumpButtonPressTime = 0
 
float _lastJumpAt = 0
 
bool _stillGroundedAfterJump
 
bool _jumpButtonPressed = false
 
bool _jumpButtonReleased = false
 
bool _doubleJumping = false
 
CharacterWalljump _characterWallJump = null
 
CharacterCrouch _characterCrouch = null
 
CharacterButtonActivation _characterButtonActivation = null
 
CharacterLadder _characterLadder = null
 
int _initialNumberOfJumps
 
float _lastTimeGrounded = 0f
 
float _lastInputBufferJumpAt = 0f
 
bool _coyoteTime = false
 
bool _inputBuffer = false
 
bool _jumpingDownFromOneWayPlatform = false
 
float _lastJumpButtonDownTimestamp = 0f
 
int _jumpingAnimationParameter
 
int _doubleJumpingAnimationParameter
 
int _hitTheGroundAnimationParameter
 
int _numberOfJumpsLeftAnimationParameter
 
- 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 _jumpingAnimationParameterName = "Jumping"
 
const string _doubleJumpingAnimationParameterName = "DoubleJumping"
 
const string _hitTheGroundAnimationParameterName = "HitTheGround"
 
const string _numberOfJumpsLeftParameterName = "NumberOfJumpsLeft"
 

Properties

bool JumpHappenedThisFrame [get, set]
 whether or not the jump happened this frame More...
 
bool CanJumpStop [get, set]
 whether or not the jump can be stopped More...
 
virtual bool JumpAuthorized [get]
 Evaluates the jump restrictions. More...
 
- 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 jump Animator parameters : Jumping (bool), DoubleJumping (bool), HitTheGround (bool)

Member Enumeration Documentation

◆ JumpBehavior

the possible jump restrictions

Enumerator
CanJumpOnGround 
CanJumpOnGroundAndFromLadders 
CanJumpAnywhere 
CantJump 
CanJumpAnywhereAnyNumberOfTimes 

Member Function Documentation

◆ EvaluateJumpConditions()

virtual bool MoreMountains.CorgiEngine.CharacterJump.EvaluateJumpConditions ( )
protectedvirtual

Evaluates the jump conditions to determine whether or not a jump can occur

Returns
true, if jump conditions was evaluated, false otherwise.

◆ EvaluateJumpTimeWindow()

virtual bool MoreMountains.CorgiEngine.CharacterJump.EvaluateJumpTimeWindow ( )
protectedvirtual

Determines if whether or not a Character is still in its Jump Window (the delay during which, after falling off a cliff, a jump is still possible without requiring multiple jumps)

Returns
true, if jump time window was evaluated, false otherwise.

◆ HandleInput()

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

At the beginning of each cycle we check if we've just pressed or released the jump button

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ HandlePreventedJump()

virtual void MoreMountains.CorgiEngine.CharacterJump.HandlePreventedJump ( )
protectedvirtual

Checks if the character is still grounded after a jump, potentially prevented by reset forces by another ability / weapon

◆ HelpBoxText()

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

On Start() we reset our number of jumps

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ InitializeAnimatorParameters()

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

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

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ JumpDownFromOneWayPlatform()

virtual bool MoreMountains.CorgiEngine.CharacterJump.JumpDownFromOneWayPlatform ( )
virtual

Handles jumping down from a one way platform.

◆ JumpFromMovingPlatform()

virtual void MoreMountains.CorgiEngine.CharacterJump.JumpFromMovingPlatform ( )
protectedvirtual

Handles jumping from a moving platform.

◆ JumpStart()

virtual void MoreMountains.CorgiEngine.CharacterJump.JumpStart ( )
virtual

Causes the character to start jumping.

◆ JumpStop()

virtual void MoreMountains.CorgiEngine.CharacterJump.JumpStop ( )
virtual

Causes the character to stop jumping.

◆ ProcessAbility()

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

Every frame we perform a number of checks related to jump

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ ResetAbility()

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

Resets parameters in anticipation for the Character's respawn.

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ ResetInitialNumberOfJumps()

virtual void MoreMountains.CorgiEngine.CharacterJump.ResetInitialNumberOfJumps ( )
protectedvirtual

Stores the current NumberOfJumps

◆ ResetJumpButtonReleased()

virtual void MoreMountains.CorgiEngine.CharacterJump.ResetJumpButtonReleased ( )
virtual

Resets the jump button released flag.

◆ ResetNumberOfJumps()

virtual void MoreMountains.CorgiEngine.CharacterJump.ResetNumberOfJumps ( )
virtual

Resets the number of jumps.

◆ SetCanJumpStop()

virtual void MoreMountains.CorgiEngine.CharacterJump.SetCanJumpStop ( bool  status)
virtual

Use this method, from any class, to prevent the current jump from being proportional (releasing won't cancel the jump/current momentum)

Parameters
status

◆ SetJumpFlags()

virtual void MoreMountains.CorgiEngine.CharacterJump.SetJumpFlags ( )
virtual

Resets jump flags

◆ SetNumberOfJumpsLeft()

virtual void MoreMountains.CorgiEngine.CharacterJump.SetNumberOfJumpsLeft ( int  newNumberOfJumps)
virtual

Sets the number of jumps left.

Parameters
newNumberOfJumpsNew number of jumps.

◆ UpdateAnimator()

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

At the end of each cycle, sends Jumping states to the Character's animator

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ UpdateController()

virtual void MoreMountains.CorgiEngine.CharacterJump.UpdateController ( )
protectedvirtual

Updates the controller state based on our current jumping state

Member Data Documentation

◆ _characterButtonActivation

CharacterButtonActivation MoreMountains.CorgiEngine.CharacterJump._characterButtonActivation = null
protected

◆ _characterCrouch

CharacterCrouch MoreMountains.CorgiEngine.CharacterJump._characterCrouch = null
protected

◆ _characterLadder

CharacterLadder MoreMountains.CorgiEngine.CharacterJump._characterLadder = null
protected

◆ _characterWallJump

CharacterWalljump MoreMountains.CorgiEngine.CharacterJump._characterWallJump = null
protected

◆ _coyoteTime

bool MoreMountains.CorgiEngine.CharacterJump._coyoteTime = false
protected

◆ _doubleJumping

bool MoreMountains.CorgiEngine.CharacterJump._doubleJumping = false
protected

◆ _doubleJumpingAnimationParameter

int MoreMountains.CorgiEngine.CharacterJump._doubleJumpingAnimationParameter
protected

◆ _doubleJumpingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterJump._doubleJumpingAnimationParameterName = "DoubleJumping"
staticprotected

◆ _hitTheGroundAnimationParameter

int MoreMountains.CorgiEngine.CharacterJump._hitTheGroundAnimationParameter
protected

◆ _hitTheGroundAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterJump._hitTheGroundAnimationParameterName = "HitTheGround"
staticprotected

◆ _initialNumberOfJumps

int MoreMountains.CorgiEngine.CharacterJump._initialNumberOfJumps
protected

◆ _inputBuffer

bool MoreMountains.CorgiEngine.CharacterJump._inputBuffer = false
protected

◆ _jumpButtonPressed

bool MoreMountains.CorgiEngine.CharacterJump._jumpButtonPressed = false
protected

◆ _jumpButtonPressTime

float MoreMountains.CorgiEngine.CharacterJump._jumpButtonPressTime = 0
protected

◆ _jumpButtonReleased

bool MoreMountains.CorgiEngine.CharacterJump._jumpButtonReleased = false
protected

◆ _jumpingAnimationParameter

int MoreMountains.CorgiEngine.CharacterJump._jumpingAnimationParameter
protected

◆ _jumpingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterJump._jumpingAnimationParameterName = "Jumping"
staticprotected

◆ _jumpingDownFromOneWayPlatform

bool MoreMountains.CorgiEngine.CharacterJump._jumpingDownFromOneWayPlatform = false
protected

◆ _lastInputBufferJumpAt

float MoreMountains.CorgiEngine.CharacterJump._lastInputBufferJumpAt = 0f
protected

◆ _lastJumpAt

float MoreMountains.CorgiEngine.CharacterJump._lastJumpAt = 0
protected

◆ _lastJumpButtonDownTimestamp

float MoreMountains.CorgiEngine.CharacterJump._lastJumpButtonDownTimestamp = 0f
protected

◆ _lastTimeGrounded

float MoreMountains.CorgiEngine.CharacterJump._lastTimeGrounded = 0f
protected

◆ _numberOfJumpsLeftAnimationParameter

int MoreMountains.CorgiEngine.CharacterJump._numberOfJumpsLeftAnimationParameter
protected

◆ _numberOfJumpsLeftParameterName

const string MoreMountains.CorgiEngine.CharacterJump._numberOfJumpsLeftParameterName = "NumberOfJumpsLeft"
staticprotected

◆ _stillGroundedAfterJump

bool MoreMountains.CorgiEngine.CharacterJump._stillGroundedAfterJump
protected

◆ AirJumpFeedbacks

MMFeedbacks MoreMountains.CorgiEngine.CharacterJump.AirJumpFeedbacks

the MMFeedbacks to play when jumping in the air

◆ CanJumpDownOneWayPlatforms

bool MoreMountains.CorgiEngine.CharacterJump.CanJumpDownOneWayPlatforms = true

if this is true, this character can jump down one way platforms by doing down + jump

◆ CoyoteTime

float MoreMountains.CorgiEngine.CharacterJump.CoyoteTime = 0f

a timeframe during which, after leaving the ground, the character can still trigger a jump

◆ DoubleJumpFeedbacks

MMFeedbacks MoreMountains.CorgiEngine.CharacterJump.DoubleJumpFeedbacks

the MMFeedbacks to play when double jumping

◆ FixedAerialJumpCount

bool MoreMountains.CorgiEngine.CharacterJump.FixedAerialJumpCount = false

deducts an additional jump if the sequence begins in the air. This keeps aerial jump count consistent regardless of whether the first jump began in the air or on the ground.

◆ InputBufferDuration

float MoreMountains.CorgiEngine.CharacterJump.InputBufferDuration = 0f

if the character lands, and the jump button's been pressed during that InputBufferDuration, a new jump will be triggered

◆ JumpHeight

float MoreMountains.CorgiEngine.CharacterJump.JumpHeight = 3.025f

defines how high the character can jump

◆ JumpIsProportionalToThePressTime

bool MoreMountains.CorgiEngine.CharacterJump.JumpIsProportionalToThePressTime = true

if true, the jump duration/height will be proportional to the duration of the button's press

◆ JumpMinimumAirTime

float MoreMountains.CorgiEngine.CharacterJump.JumpMinimumAirTime = 0.1f

the minimum time in the air allowed when jumping - this is used for pressure controlled jumps

◆ JumpReleaseForceFactor

float MoreMountains.CorgiEngine.CharacterJump.JumpReleaseForceFactor = 2f

the amount by which we'll modify the current speed when the jump button gets released

◆ JumpRestrictions

JumpBehavior MoreMountains.CorgiEngine.CharacterJump.JumpRestrictions = JumpBehavior.CanJumpAnywhere

basic rules for jumps : where can the player jump ?

◆ MovingPlatformsJumpCollisionOffDuration

float MoreMountains.CorgiEngine.CharacterJump.MovingPlatformsJumpCollisionOffDuration = 0.05f

duration (in seconds) we need to disable collisions when jumping off a moving platform

◆ NumberOfJumps

int MoreMountains.CorgiEngine.CharacterJump.NumberOfJumps = 2

the maximum number of jumps allowed (0 : no jump, 1 : normal jump, 2 : double jump, etc...)

◆ NumberOfJumpsLeft

int MoreMountains.CorgiEngine.CharacterJump.NumberOfJumpsLeft

the number of jumps left to the character

◆ OneWayPlatformsJumpCollisionOffDuration

float MoreMountains.CorgiEngine.CharacterJump.OneWayPlatformsJumpCollisionOffDuration = 0.3f

duration (in seconds) we need to disable collisions when jumping down a 1 way platform

◆ ResetCameraOffsetOnJump

bool MoreMountains.CorgiEngine.CharacterJump.ResetCameraOffsetOnJump = false

if this is true, camera offset will be reset on jump

Property Documentation

◆ CanJumpStop

bool MoreMountains.CorgiEngine.CharacterJump.CanJumpStop
getset

whether or not the jump can be stopped

◆ JumpAuthorized

virtual bool MoreMountains.CorgiEngine.CharacterJump.JumpAuthorized
get

Evaluates the jump restrictions.

◆ JumpHappenedThisFrame

bool MoreMountains.CorgiEngine.CharacterJump.JumpHappenedThisFrame
getset

whether or not the jump happened this frame


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