UnityToolbox
Brief documentation for all existing scripts.
 
Loading...
Searching...
No Matches
UnityToolbox.PlayerControls.MovementBase Class Referenceabstract

The base implementation of all player movement.

Inheritance diagram for UnityToolbox.PlayerControls.MovementBase:
UnityToolbox.PlayerControls.ThreeD.Movement3D UnityToolbox.PlayerControls.TwoD.Movement2DSide UnityToolbox.PlayerControls.TwoD.Movement2DTop

Public Member Functions

void UpdateMovementState ()
 Updates the current state of movement. MovementState.Moving does not mean that the current velocity is > 0!
 
abstract void Move (Vector3 direction)
 Updates the player movement with the direction data.
 
abstract void Jump ()
 Updates the player movement to execute a jump.
 
abstract void MoveWithStrength (Vector3 direction, Vector3 strength)
 Updates the player movement with the direction data and defined strength .
 
abstract Vector3 GetCurrentVelocity ()
 

Protected Attributes

float _speed
 Defines the speed of the player.
 
float _toggledSpeed
 Defines the toggledSpeed of the player.
 
float _jumpForce
 Defines the amount of force (speed) for a jump.
 
float _climbingForce
 Defines the amount of force (speed) for climbing.
 
string _movementActionName
 The action name for the movement controls. Needs to be defined as a Vector2D.
 
string _toggleSpeedActionName
 The action name for the changing the players speed.
 
string _jumpActionName
 The action name for the jump control.
 
string _attackActionName
 The action name for the attack control.
 
Transform _groundedTransform
 The transform defines the position where to define if the player is grounded or not.
 
PlayerInput _input
 The player input.
 
bool _isMovementLocked
 Defines whether the movement should be locked or not. The PlayerEventManager also has events for this.
 
bool _isClimbingLocked
 Defines whether the climbing should be locked or not.
 
bool _isJumpingLocked
 Defines whether the jumping should be locked or not.
 
MovementState _currentMovementState
 The current movement state. (MovementState.Climbing, MovementState.Moving, MovementState.Jumping) MovementState.Moving does not mean that the current velocity is > 0.
 
LayerMask _climbingMask
 The climbing layer mask, which defines which objects should be read as climbable.
 
LayerMask _jumpingMask
 The jumping layer mask, which defines which objects should be read as jumpable.
 
bool _grounded
 Defines whether the player is grounded.
 
bool _animationGrounded
 Defines whether the animation should be counted as grounded. A usecase would be a delay between the actual MovementBase.Grounded.
 
bool _climbing
 Defines whether the player is climbing.
 
bool _isToggledMoving
 

Properties

Transform GroundedTransform [get]
 
bool IsMovementLocked [get, set]
 
bool IsClimbingLocked [get, set]
 
bool IsJumpingLocked [get, set]
 
MovementState CurrentMovementState [get]
 
bool Grounded [get]
 
bool AnimationGrounded [get]
 
bool Climbing [get]
 
bool IsToggledMoving [get]
 

Member Function Documentation

◆ GetCurrentVelocity()

abstract Vector3 UnityToolbox.PlayerControls.MovementBase.GetCurrentVelocity ( )
pure virtual

◆ Jump()

abstract void UnityToolbox.PlayerControls.MovementBase.Jump ( )
pure virtual

◆ Move()

abstract void UnityToolbox.PlayerControls.MovementBase.Move ( Vector3  direction)
pure virtual

◆ MoveWithStrength()

abstract void UnityToolbox.PlayerControls.MovementBase.MoveWithStrength ( Vector3  direction,
Vector3  strength 
)
pure virtual

◆ UpdateMovementState()

Member Data Documentation

◆ _animationGrounded

bool UnityToolbox.PlayerControls.MovementBase._animationGrounded
protected

◆ _attackActionName

string UnityToolbox.PlayerControls.MovementBase._attackActionName
protected

◆ _climbing

bool UnityToolbox.PlayerControls.MovementBase._climbing
protected

◆ _climbingForce

float UnityToolbox.PlayerControls.MovementBase._climbingForce
protected

◆ _climbingMask

LayerMask UnityToolbox.PlayerControls.MovementBase._climbingMask
protected

◆ _currentMovementState

◆ _grounded

bool UnityToolbox.PlayerControls.MovementBase._grounded
protected

◆ _groundedTransform

Transform UnityToolbox.PlayerControls.MovementBase._groundedTransform
protected

◆ _input

PlayerInput UnityToolbox.PlayerControls.MovementBase._input
protected

◆ _isClimbingLocked

bool UnityToolbox.PlayerControls.MovementBase._isClimbingLocked
protected

◆ _isJumpingLocked

bool UnityToolbox.PlayerControls.MovementBase._isJumpingLocked
protected

◆ _isMovementLocked

bool UnityToolbox.PlayerControls.MovementBase._isMovementLocked
protected

◆ _isToggledMoving

bool UnityToolbox.PlayerControls.MovementBase._isToggledMoving
protected

◆ _jumpActionName

string UnityToolbox.PlayerControls.MovementBase._jumpActionName
protected

◆ _jumpForce

◆ _jumpingMask

LayerMask UnityToolbox.PlayerControls.MovementBase._jumpingMask
protected

◆ _movementActionName

string UnityToolbox.PlayerControls.MovementBase._movementActionName
protected

◆ _speed

◆ _toggledSpeed

float UnityToolbox.PlayerControls.MovementBase._toggledSpeed
protected

◆ _toggleSpeedActionName

string UnityToolbox.PlayerControls.MovementBase._toggleSpeedActionName
protected

Property Documentation

◆ AnimationGrounded

bool UnityToolbox.PlayerControls.MovementBase.AnimationGrounded
get

◆ Climbing

bool UnityToolbox.PlayerControls.MovementBase.Climbing
get

◆ CurrentMovementState

MovementState UnityToolbox.PlayerControls.MovementBase.CurrentMovementState
get

◆ Grounded

bool UnityToolbox.PlayerControls.MovementBase.Grounded
get

◆ GroundedTransform

Transform UnityToolbox.PlayerControls.MovementBase.GroundedTransform
get

◆ IsClimbingLocked

bool UnityToolbox.PlayerControls.MovementBase.IsClimbingLocked
getset

◆ IsJumpingLocked

bool UnityToolbox.PlayerControls.MovementBase.IsJumpingLocked
getset

◆ IsMovementLocked

bool UnityToolbox.PlayerControls.MovementBase.IsMovementLocked
getset

◆ IsToggledMoving

bool UnityToolbox.PlayerControls.MovementBase.IsToggledMoving
get