117 lines
1.7 KiB
C++
117 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include "blitz/common/Defines.h"
|
|
#include "blitz/maths/Vector.h"
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace blitz {
|
|
namespace game {
|
|
|
|
struct PlayerStats {
|
|
std::uint16_t m_Deaths;
|
|
std::uint16_t m_Kills;
|
|
std::uint32_t m_ShootCount;
|
|
std::uint32_t m_ShootSuccessCount;
|
|
};
|
|
|
|
class Player {
|
|
private:
|
|
PlayerID m_ID;
|
|
std::string m_Name;
|
|
Vec3f m_Position;
|
|
Vec3f m_Velocity;
|
|
float m_Yaw;
|
|
float m_Pitch;
|
|
float m_HP;
|
|
bool m_IsBot;
|
|
|
|
public:
|
|
Player(PlayerID id) : m_ID(id), m_Yaw(0), m_Pitch(0), m_HP(100), m_IsBot(false) {}
|
|
PlayerStats m_Stats{};
|
|
|
|
PlayerID GetID() const {
|
|
return m_ID;
|
|
}
|
|
|
|
const std::string& GetName() const {
|
|
return m_Name;
|
|
}
|
|
|
|
void SetName(const std::string& name) {
|
|
m_Name = name;
|
|
}
|
|
|
|
const Vec3f& GetPosition() const {
|
|
return m_Position;
|
|
}
|
|
|
|
void SetPosition(const Vec3f& newPos) {
|
|
m_Position = newPos;
|
|
}
|
|
|
|
void AddPosition(const Vec3f& dPos) {
|
|
m_Position += dPos;
|
|
}
|
|
|
|
const Vec3f& GetVelocity() const {
|
|
return m_Velocity;
|
|
}
|
|
|
|
void SetVelocity(const Vec3f& newVelocity) {
|
|
m_Velocity = newVelocity;
|
|
}
|
|
|
|
float GetYaw() const {
|
|
return m_Yaw;
|
|
}
|
|
|
|
void SetYaw(float yaw) {
|
|
m_Yaw = yaw;
|
|
}
|
|
|
|
void AddYaw(float dYaw) {
|
|
m_Yaw += dYaw;
|
|
}
|
|
|
|
float GetPitch() const {
|
|
return m_Pitch;
|
|
}
|
|
|
|
void SetPitch(float pitch) {
|
|
m_Pitch = pitch;
|
|
}
|
|
|
|
void AddPitch(float dPitch) {
|
|
m_Pitch += dPitch;
|
|
}
|
|
|
|
float GetHP() const {
|
|
return m_HP;
|
|
}
|
|
|
|
void SetHP(float hp) {
|
|
m_HP = hp;
|
|
}
|
|
|
|
bool IsBot() const {
|
|
return m_IsBot;
|
|
}
|
|
|
|
void SetBot() {
|
|
m_IsBot = true;
|
|
}
|
|
|
|
PlayerStats& GetStats() {
|
|
return m_Stats;
|
|
}
|
|
|
|
void SetStats(const PlayerStats& stats) {
|
|
m_Stats = stats;
|
|
}
|
|
};
|
|
|
|
|
|
} // namespace game
|
|
} // namespace blitz
|