mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
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:
14
src/gameplay/entity.cpp
Normal file
14
src/gameplay/entity.cpp
Normal 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
|
||||
Reference in New Issue
Block a user