|
R-Type
Distributed multiplayer game engine in C++
|
Component representing movement direction and speed. More...
#include <Velocity.hpp>


Classes | |
| struct | Vector2 |
| 2D vector for direction. More... | |
Public Member Functions | |
| Velocity (float dirX, float dirY, float speed) | |
| Constructor with direction and speed. | |
| ~Velocity () override=default | |
| Vector2 | getDirection () const |
| Get the direction vector. | |
| float | getSpeed () const |
| Get the movement speed. | |
| float | getBaseSpeed () const |
| Get the base movement speed (before buffs). | |
| void | setDirection (float dirX, float dirY) |
| Set the direction vector. | |
| void | setSpeed (float speed) |
| Set the movement speed. | |
| ComponentType | getType () const override |
| Get the component type ID. | |
Public Member Functions inherited from ecs::IComponent | |
| virtual | ~IComponent ()=default |
| Virtual destructor. | |
Private Attributes | |
| Vector2 | _direction |
| Movement direction vector. | |
| float | _speed |
| Movement speed in units per second. | |
| float | _baseSpeed |
| Base speed (before buffs) | |
Component representing movement direction and speed.
This component stores the velocity data for moving entities. Direction should typically be normalized, and speed determines magnitude.
Definition at line 20 of file Velocity.hpp.
|
inline |
Constructor with direction and speed.
| dirX | X direction component |
| dirY | Y direction component |
| speed | Movement speed in units per second |
Definition at line 37 of file Velocity.hpp.
|
overridedefault |
|
inline |
Get the base movement speed (before buffs).
Definition at line 57 of file Velocity.hpp.
References _baseSpeed.
Referenced by ecs::BuffSystem::_applySpeedBoost().
|
inline |
Get the direction vector.
Definition at line 45 of file Velocity.hpp.
References _direction.
Referenced by scripting::bindings::bindComponents(), ecs::WeaponSystem::createProjectile(), and server::GameStateSerializer::serializeEntity().
|
inline |
Get the movement speed.
Definition at line 51 of file Velocity.hpp.
References _speed.
Referenced by server::GameLogic::_applyPlayerInput(), scripting::bindings::bindComponents(), ecs::WeaponSystem::createProjectile(), and server::GameStateSerializer::serializeEntity().
|
inlineoverridevirtual |
Get the component type ID.
Implements ecs::IComponent.
Definition at line 79 of file Velocity.hpp.
|
inline |
Set the direction vector.
| dirX | New X direction |
| dirY | New Y direction |
Definition at line 64 of file Velocity.hpp.
References _direction, ecs::Velocity::Vector2::x, and ecs::Velocity::Vector2::y.
Referenced by server::GameLogic::_applyPlayerInput(), and scripting::bindings::bindComponents().
|
inline |
Set the movement speed.
| speed | New speed value in units per second |
Definition at line 73 of file Velocity.hpp.
References _speed.
Referenced by ecs::BuffSystem::_applySpeedBoost(), and scripting::bindings::bindComponents().
|
private |
|
private |
Movement direction vector.
Definition at line 82 of file Velocity.hpp.
Referenced by getDirection(), and setDirection().
|
private |
Movement speed in units per second.
Definition at line 83 of file Velocity.hpp.
Referenced by getSpeed(), and setSpeed().