process tower creation
This commit is contained in:
@@ -6,9 +6,17 @@ namespace sim {
|
|||||||
CommandApply::CommandApply(const game::World& a_World, WorldSnapshot& a_Snapshot) : m_World(a_World), m_Snapshot(a_Snapshot) {}
|
CommandApply::CommandApply(const game::World& a_World, WorldSnapshot& a_Snapshot) : m_World(a_World), m_Snapshot(a_Snapshot) {}
|
||||||
|
|
||||||
void CommandApply::Handle(const protocol::commands::EndCommand& a_End) {}
|
void CommandApply::Handle(const protocol::commands::EndCommand& a_End) {}
|
||||||
|
|
||||||
void CommandApply::Handle(const protocol::commands::PlaceTowerCommand& a_PlaceTower) {
|
void CommandApply::Handle(const protocol::commands::PlaceTowerCommand& a_PlaceTower) {
|
||||||
m_World.CanPlaceBigTower({}, 0);
|
static game::TowerFactory factory;
|
||||||
|
|
||||||
|
auto tower = std::shared_ptr<game::Tower>(factory.CreateMessage(*a_PlaceTower->m_Type).release());
|
||||||
|
tower->m_Builder = *a_PlaceTower->m_Placer;
|
||||||
|
tower->SetCenter(utils::shape::Point(a_PlaceTower->m_Position.x, a_PlaceTower->m_Position.y));
|
||||||
|
|
||||||
|
m_Snapshot.m_Towers.push_back(tower);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandApply::Handle(const protocol::commands::PlayerJoinCommand& a_PlayerJoin) {}
|
void CommandApply::Handle(const protocol::commands::PlayerJoinCommand& a_PlayerJoin) {}
|
||||||
|
|
||||||
void CommandApply::Handle(const protocol::commands::SpawnTroopCommand& a_SpawnTroop) {
|
void CommandApply::Handle(const protocol::commands::SpawnTroopCommand& a_SpawnTroop) {
|
||||||
|
|||||||
Reference in New Issue
Block a user