changed team structure
This commit is contained in:
@@ -1,21 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "Towers.h"
|
||||
#include "Types.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
|
||||
enum class Direction : std::uint8_t{
|
||||
PositiveX = 1 << 0,
|
||||
NegativeX = 1 << 1,
|
||||
PositiveY = 1 << 2,
|
||||
NegativeY = 1 << 3,
|
||||
};
|
||||
|
||||
enum class EffectType : std::uint8_t{
|
||||
Slowness = 0,
|
||||
Stun,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Types.h"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
@@ -15,10 +17,22 @@ enum class TeamColor : std::int8_t{
|
||||
Blue
|
||||
};
|
||||
|
||||
struct Spawn{
|
||||
Direction direction;
|
||||
std::int32_t x, y;
|
||||
};
|
||||
|
||||
struct TeamCastle{
|
||||
std::int32_t x, y;
|
||||
std::uint16_t life = 1000;
|
||||
};
|
||||
|
||||
class Team{
|
||||
private:
|
||||
std::vector<Player*> m_Players;
|
||||
TeamColor m_Color;
|
||||
Spawn m_Spawn;
|
||||
TeamCastle m_TeamCastle;
|
||||
public:
|
||||
Team(TeamColor color);
|
||||
|
||||
@@ -27,6 +41,12 @@ public:
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
16
include/game/Types.h
Normal file
16
include/game/Types.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
|
||||
enum class Direction : std::uint8_t{
|
||||
PositiveX = 1 << 0,
|
||||
NegativeX = 1 << 1,
|
||||
PositiveY = 1 << 2,
|
||||
NegativeY = 1 << 3,
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
} // namespace td
|
||||
@@ -76,16 +76,6 @@ struct DecorationTile : Tile{
|
||||
virtual TileType getType() const{ return TileType::Decoration; }
|
||||
};
|
||||
|
||||
struct Spawn{
|
||||
Direction direction;
|
||||
std::int32_t x, y;
|
||||
};
|
||||
|
||||
struct TeamCastle{
|
||||
std::int32_t x, y;
|
||||
std::uint16_t life = 1000;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<Tile> TilePtr;
|
||||
typedef std::vector<std::uint16_t> ChunkPalette;
|
||||
|
||||
@@ -130,9 +120,6 @@ protected:
|
||||
|
||||
SpawnColorPalette m_SpawnColorPalette;
|
||||
|
||||
Spawn m_Spawns[2];
|
||||
TeamCastle m_Castles[2];
|
||||
|
||||
TilePalette m_TilePalette;
|
||||
|
||||
MobList m_Mobs;
|
||||
@@ -167,21 +154,22 @@ public:
|
||||
|
||||
const std::unordered_map<ChunkCoord, ChunkPtr>& getChunks() const{ return m_Chunks; }
|
||||
|
||||
const Spawn& getRedSpawn() const{ return m_Spawns[(std::size_t) TeamColor::Red]; }
|
||||
const Spawn& getBlueSpawn() const{ return m_Spawns[(std::size_t) TeamColor::Blue]; }
|
||||
|
||||
const Spawn& getSpawn(TeamColor color) const{ return m_Spawns[(std::size_t) color]; }
|
||||
|
||||
const Color& getSpawnColor(TeamColor color) const{ return m_SpawnColorPalette[(std::size_t) color]; }
|
||||
const SpawnColorPalette& getSpawnColors() const{ return m_SpawnColorPalette; }
|
||||
|
||||
const TeamCastle& getRedCastle() const{ return m_Castles[(std::size_t) TeamColor::Red]; }
|
||||
const TeamCastle& getBlueCastle() const{ return m_Castles[(std::size_t) TeamColor::Blue]; }
|
||||
|
||||
const MobList& getMobList() const{ return m_Mobs; }
|
||||
MobList& getMobList(){ return m_Mobs; }
|
||||
|
||||
const Color& getTileColor(TilePtr tile) const;
|
||||
|
||||
Team& getRedTeam();
|
||||
const Team& getRedTeam() const;
|
||||
|
||||
Team& getBlueTeam();
|
||||
const Team& getBlueTeam() const;
|
||||
|
||||
Team& getTeam(TeamColor team);
|
||||
const Team& getTeam(TeamColor team) const;
|
||||
private:
|
||||
void moveMobs(std::uint64_t delta);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user