feat: add player upgrades
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "game/Team.h"
|
||||
#include "game/PlayerUpgrades.h"
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
@@ -11,17 +12,16 @@ namespace game {
|
||||
class Player {
|
||||
private:
|
||||
game::TeamColor m_TeamColor;
|
||||
PlayerUpgrades m_Upgrades;
|
||||
|
||||
std::uint32_t m_Gold;
|
||||
std::uint32_t m_Exp;
|
||||
std::string m_Name;
|
||||
PlayerID m_ID;
|
||||
|
||||
std::uint8_t m_GoldPerSecond;
|
||||
|
||||
public:
|
||||
|
||||
Player(std::uint8_t id = 0) : m_TeamColor(game::TeamColor::None), m_Gold(0), m_Exp(0), m_ID(id), m_GoldPerSecond(5) {}
|
||||
Player(std::uint8_t id = 0) : m_TeamColor(game::TeamColor::None), m_Gold(0), m_Exp(0), m_ID(id) {}
|
||||
|
||||
const std::string& GetName() const { return m_Name; }
|
||||
void SetName(const std::string& name) { m_Name = name; }
|
||||
@@ -29,9 +29,6 @@ public:
|
||||
game::TeamColor GetTeamColor() const { return m_TeamColor; }
|
||||
void SetTeamColor(game::TeamColor teamColor) { m_TeamColor = teamColor; }
|
||||
|
||||
std::uint8_t GetGoldPerSecond() const { return m_GoldPerSecond; }
|
||||
void SetGoldPerSecond(std::uint8_t goldPerSecond) { m_GoldPerSecond = goldPerSecond; }
|
||||
|
||||
std::uint32_t GetGold() const { return m_Gold; }
|
||||
void SetGold(std::uint32_t gold) { m_Gold = gold; }
|
||||
void AddGold(std::uint32_t gold) { m_Gold += gold; }
|
||||
@@ -42,6 +39,9 @@ public:
|
||||
void AddExp(std::uint32_t exp) { m_Exp += exp; }
|
||||
void RemoveExp(std::uint32_t exp) { m_Exp -= exp; }
|
||||
|
||||
const PlayerUpgrades& getUpgrades() const { return m_Upgrades; }
|
||||
PlayerUpgrades& getUpgrades() { return m_Upgrades; }
|
||||
|
||||
PlayerID GetID() const { return m_ID; }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user