refactor: separate mob ans world listener

This commit is contained in:
2021-12-11 18:43:49 +01:00
parent a802b5cef5
commit 1474220a77
7 changed files with 38 additions and 21 deletions

View File

@@ -4,6 +4,8 @@
#include "Types.h"
#include "Team.h"
#include "misc/ObjectNotifier.h"
#include <vector>
#include <memory>
@@ -218,6 +220,18 @@ MobPtr createMob(MobID id, MobType type, std::uint8_t level, PlayerID sender);
std::string getMobName(MobType type);
}
class MobListener {
public:
virtual void OnMobSpawn(MobPtr mob) {}
virtual void OnMobDie(MobPtr mob) {}
virtual void OnMobDamage(MobPtr target, float damage, Tower* damager) {}
virtual void OnMobTouchCastle(MobPtr damager, TeamCastle* enemyCastle) {}
virtual void OnMobCastleDamage(MobPtr damager, TeamCastle* enemyCastle) {}
};
typedef utils::ObjectNotifier<MobListener> MobNotifier;
} // namespace game
} // namespace td