Files
Blitz/include/blitz/game/Player.h
Persson-dev 0ed577bbc2
Some checks are pending
Linux arm64 / Build (push) Waiting to run
On sait quand on gagne (#29)
L'écran de fin est mis à jour correctement selon si la victoire nous appartient ou non.
Le cas d'égalité n'est cependant pas traité ! Seulement un joueur peut gagner à l'état actuel

Reviewed-on: #29
Co-authored-by: Persson-dev <sim16.prib@gmail.com>
Co-committed-by: Persson-dev <sim16.prib@gmail.com>
2024-03-30 19:37:08 +01:00

121 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;
}
const PlayerStats& GetStats() const {
return m_Stats;
}
PlayerStats& GetStats() {
return m_Stats;
}
void SetStats(const PlayerStats& stats) {
m_Stats = stats;
}
};
} // namespace game
} // namespace blitz