restructure project
This commit is contained in:
22
src/td/game/towers/IceTower.cpp
Normal file
22
src/td/game/towers/IceTower.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "td/game/Towers.h"
|
||||
#include "td/game/World.h"
|
||||
|
||||
namespace td {
|
||||
namespace game {
|
||||
|
||||
void IceTower::Tick(std::uint64_t delta, World* world) {
|
||||
if (m_Timer.Update(delta)) {
|
||||
float damage = GetStats()->GetDamage();
|
||||
for (MobPtr mob : world->GetMobList()) {
|
||||
if (IsMobInRange(mob)) {
|
||||
mob->AddEffect(EffectType::Slowness, 1, this); // slowness for 1s every second
|
||||
if (damage > 0)
|
||||
world->GetMobNotifier().NotifyListeners(&MobListener::OnMobDamage, mob.get(), damage, this);
|
||||
m_Timer.ApplyCooldown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace game
|
||||
} // namespace td
|
||||
Reference in New Issue
Block a user