refactor(gameplay): extract Entity base class from ClientPlayer

Move position, walk pose, velocity, orientation, movement, and gravity
fields and their accessors into a new Entity base class. ClientPlayer now
inherits from Entity, removing duplicated members. Also update velocity
handling to use 3D vector per axis and adjust related logic.
This commit is contained in:
2026-07-28 09:27:28 +08:00
parent 802d2ecb5a
commit a5c1c7d4aa
6 changed files with 108 additions and 72 deletions

14
src/gameplay/entity.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include "Cubed/gameplay/entity.hpp"
namespace Cubed {
glm::vec3& Entity::max_speed() { return m_velocity.max; }
float& Entity::acceleration() { return m_movement.acceleration; }
float& Entity::deceleration() { return m_movement.deceleration; }
float& Entity::g() { return m_gravity.value; }
void Entity::set_gait(Gait gait) { m_walk_pos.gait = gait; }
float Entity::yaw() const { return m_angle.yaw; }
float Entity::pitch() const { return m_angle.pitch; }
float& Entity::roll() { return m_angle.roll; }
float& Entity::walk_time() { return m_walk_pos.walk_time; }
Gait Entity::get_gait() const { return m_walk_pos.gait; }
} // namespace Cubed