mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
Move per-axis collision detection and move distance calculation to new PhysicalSystem. Move SpeedSystem implementation from inline header to separate .cpp file. Add const accessors to Entity. Replace inline AABB helper with HitboxManager registration of player hitbox using new PLAYER_SIZE constant. Remove obsolete members and functions from ClientPlayer.
24 lines
642 B
C++
24 lines
642 B
C++
#pragma once
|
|
#include "glm/ext/vector_float3.hpp"
|
|
|
|
#include <stdexcept>
|
|
#include <utility>
|
|
namespace Cubed {
|
|
enum class Gait { STOP = 0, WALK = 1, RUN = 2 };
|
|
constexpr int get_gait_id(Gait gait) { return std::to_underlying(gait); }
|
|
|
|
inline Gait get_gait_from_id(int id) {
|
|
switch (id) {
|
|
case std::to_underlying(Gait::STOP):
|
|
return Gait::STOP;
|
|
case std::to_underlying(Gait::WALK):
|
|
return Gait::WALK;
|
|
case std::to_underlying(Gait::RUN):
|
|
return Gait::RUN;
|
|
default:
|
|
throw std::runtime_error("Unknown Gait");
|
|
}
|
|
}
|
|
static constexpr glm::vec3 PLAYER_SIZE{0.6f, 1.8f, 0.6f};
|
|
} // namespace Cubed
|