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

The base implementation of all player movement.

Inheritance diagram for MovementBase:
Movement2DSide Movement2DTop Movement3D

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 MovementBase.GetCurrentVelocity ( )
pure virtual
Returns
Returns the current velocity of the player.

Implemented in Movement2DSide, Movement2DTop, and Movement3D.

◆ Jump()

abstract void MovementBase.Jump ( )
pure virtual

Implemented in Movement2DSide, Movement2DTop, and Movement3D.

◆ Move()

abstract void MovementBase.Move ( Vector3  direction)
pure virtual
Parameters
direction

Implemented in Movement2DSide, Movement2DTop, and Movement3D.

◆ MoveWithStrength()

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

Implemented in Movement2DSide, Movement2DTop, and Movement3D.

◆ UpdateMovementState()

void MovementBase.UpdateMovementState ( )

Member Data Documentation

◆ _animationGrounded

bool MovementBase._animationGrounded
protected

◆ _attackActionName

string MovementBase._attackActionName
protected

◆ _climbing

bool MovementBase._climbing
protected

◆ _climbingForce

float MovementBase._climbingForce
protected

◆ _climbingMask

LayerMask MovementBase._climbingMask
protected

◆ _currentMovementState

MovementState MovementBase._currentMovementState
protected

◆ _grounded

bool MovementBase._grounded
protected

Referenced by UpdateMovementState().

◆ _groundedTransform

Transform MovementBase._groundedTransform
protected

◆ _input

PlayerInput MovementBase._input
protected

◆ _isClimbingLocked

bool MovementBase._isClimbingLocked
protected

◆ _isJumpingLocked

bool MovementBase._isJumpingLocked
protected

◆ _isMovementLocked

bool MovementBase._isMovementLocked
protected

Referenced by Movement3D.Move().

◆ _isToggledMoving

bool MovementBase._isToggledMoving
protected

◆ _jumpActionName

string MovementBase._jumpActionName
protected

◆ _jumpForce

float MovementBase._jumpForce
protected

◆ _jumpingMask

LayerMask MovementBase._jumpingMask
protected

◆ _movementActionName

string MovementBase._movementActionName
protected

◆ _speed

◆ _toggledSpeed

float MovementBase._toggledSpeed
protected

◆ _toggleSpeedActionName

string MovementBase._toggleSpeedActionName
protected

Property Documentation

◆ AnimationGrounded

bool MovementBase.AnimationGrounded
get

◆ Climbing

bool MovementBase.Climbing
get

◆ CurrentMovementState

MovementState MovementBase.CurrentMovementState
get

◆ Grounded

bool MovementBase.Grounded
get

◆ GroundedTransform

Transform MovementBase.GroundedTransform
get

◆ IsClimbingLocked

bool MovementBase.IsClimbingLocked
getset

Referenced by Movement3D.Move().

◆ IsJumpingLocked

bool MovementBase.IsJumpingLocked
getset

Referenced by Movement3D.Jump().

◆ IsMovementLocked

bool MovementBase.IsMovementLocked
getset

◆ IsToggledMoving

bool MovementBase.IsToggledMoving
get