feat: add basic tower mecanic
This commit is contained in:
@@ -322,8 +322,9 @@ bool World::saveMap(const std::string& fileName) const {
|
||||
void World::tick(std::uint64_t delta) {
|
||||
moveMobs(delta);
|
||||
for(TowerPtr tower : m_Towers){
|
||||
tower->tick(delta);
|
||||
tower->tick(delta, this);
|
||||
}
|
||||
cleanDeadMobs();
|
||||
}
|
||||
|
||||
void World::spawnMobAt(MobID id, MobType type, std::uint8_t level, PlayerID sender, float x, float y, Direction dir) {
|
||||
@@ -447,6 +448,15 @@ bool World::CanPlaceBigTower(const glm::vec2& worldPos, PlayerID playerID) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void World::cleanDeadMobs(){
|
||||
for(auto it = m_Mobs.begin(); it != m_Mobs.end(); it++){
|
||||
MobPtr mob = *it;
|
||||
if(!mob->isAlive()){
|
||||
m_Mobs.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Team& World::getRedTeam() {
|
||||
return m_Game->getRedTeam();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user