UnityToolbox
Brief documentation for all existing scripts.
 
Loading...
Searching...
No Matches
Movement2DTop Class Reference

An implementation of MovementBase which works for a side scroller.

Inheritance diagram for Movement2DTop:
MovementBase

Public Member Functions

override void Move (Vector3 direction)
 Updates the player movement with the direction data.
 
override void MoveWithStrength (Vector3 direction, Vector3 strength)
 Updates the player movement with the direction data and defined strength .
 
override Vector3 GetCurrentVelocity ()
 
override void Jump ()
 Updates the player movement to execute a jump.
 
- Public Member Functions inherited from MovementBase
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 ()
 

Additional Inherited Members

- Protected Attributes inherited from MovementBase
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 inherited from MovementBase
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()

override Vector3 Movement2DTop.GetCurrentVelocity ( )
virtual
Returns
Returns the current velocity of the player.

Implements MovementBase.

◆ Jump()

override void Movement2DTop.Jump ( )
virtual

Implements MovementBase.

◆ Move()

override void Movement2DTop.Move ( Vector3  direction)
virtual

◆ MoveWithStrength()

override void Movement2DTop.MoveWithStrength ( Vector3  direction,
Vector3  strength 
)
virtual