restructure project
This commit is contained in:
25
src/td/game/towers/ArcherTower.cpp
Normal file
25
src/td/game/towers/ArcherTower.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "td/game/Towers.h"
|
||||
#include "td/game/World.h"
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
|
||||
void ArcherTower::Tick(std::uint64_t delta, World* world) {
|
||||
if (m_Timer.Update(delta)) {
|
||||
std::uint8_t arrowsShot = 0;
|
||||
bool explosiveArrows = GetLevel().GetPath() == TowerPath::Bottom;
|
||||
std::uint8_t arrows = explosiveArrows ? 2 : GetLevel().GetLevel();
|
||||
for (MobPtr mob : world->GetMobList()) {
|
||||
if (IsMobInRange(mob)) {
|
||||
world->GetWorldNotifier().NotifyListeners(&WorldListener::OnArcherTowerShot, mob, this);
|
||||
m_Timer.ApplyCooldown();
|
||||
arrowsShot++;
|
||||
if (arrowsShot >= arrows)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace game
|
||||
} // namespace td
|
||||
Reference in New Issue
Block a user