#pragma once #include #include #include #include #include namespace td { namespace game { class Player; class Spawn : public utils::shape::Rectangle { private: Direction m_Direction; public: Spawn() : m_Direction(Direction::PositiveX) { SetWidth(5); SetHeight(5); } Direction GetDirection() const { return m_Direction; } void SetDirection(Direction direction) { m_Direction = direction; } }; class Team; class TeamCastle : public utils::shape::Rectangle { private: const Team* m_Team; float m_Life; public: static constexpr int CastleMaxLife = 1000; TeamCastle(const Team* team) : m_Team(team), m_Life(CastleMaxLife) { SetWidth(5); SetHeight(5); } TeamCastle() : TeamCastle(nullptr) {} float GetLife() const { return m_Life; } const Team* GetTeam() const { return m_Team; } void SetTeam(const Team* team) { m_Team = team; } void SetLife(float life) { m_Life = life; } void Damage(float damage) { m_Life = std::max(0.0f, m_Life - damage); } void SetShape(utils::shape::Rectangle rect) { SetCenter(rect.GetCenter()); SetSize(rect.GetSize()); } }; class Team { private: std::vector m_Players; TeamColor m_Color; Spawn m_Spawn; TeamCastle m_TeamCastle; public: Team(TeamColor color) : m_Color(color) {} void AddPlayer(Player* newPlayer); void RemovePlayer(const Player* player); TeamColor GetColor() const; const Spawn& GetSpawn() const { return m_Spawn; } Spawn& GetSpawn() { return m_Spawn; } const TeamCastle& GetCastle() const { return m_TeamCastle; } TeamCastle& GetCastle() { return m_TeamCastle; } std::uint8_t GetPlayerCount() const; }; typedef std::array TeamList; } // namespace game } // namespace td