refactor: mob die event
This commit is contained in:
@@ -73,7 +73,7 @@ public:
|
||||
struct EffectDuration {
|
||||
EffectType type;
|
||||
float duration; // in seconds
|
||||
const Tower* tower; // the tower that gived the effect
|
||||
Tower* tower; // the tower that gived the effect
|
||||
};
|
||||
|
||||
const MobStats* getMobStats(MobType type, std::uint8_t level);
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
bool isImmuneTo(TowerType type);
|
||||
|
||||
bool isImmuneTo(EffectType type);
|
||||
void addEffect(EffectType type, float durationSec, const Tower* tower);
|
||||
void addEffect(EffectType type, float durationSec, Tower* tower);
|
||||
bool hasEffect(EffectType type);
|
||||
|
||||
float getTileX() { return getCenterX() - static_cast<float>(static_cast<std::int32_t>(getCenterX())); } // returns a float between 0 and 1 excluded
|
||||
@@ -143,7 +143,7 @@ protected:
|
||||
setSize(getStats()->getSize().x, getStats()->getSize().y);
|
||||
}
|
||||
private:
|
||||
void updateEffects(std::uint64_t delta);
|
||||
void updateEffects(std::uint64_t delta, World* world);
|
||||
void attackCastle(std::uint64_t delta, World* world);
|
||||
void move(std::uint64_t delta, World* world);
|
||||
void walk(std::uint64_t delta, World* world);
|
||||
@@ -232,10 +232,10 @@ std::string getMobName(MobType type);
|
||||
|
||||
class MobListener {
|
||||
public:
|
||||
virtual void OnMobSpawn(MobPtr mob) {}
|
||||
virtual void OnMobDie(MobPtr mob) {}
|
||||
virtual void OnMobSpawn(Mob* mob) {}
|
||||
virtual void OnMobDie(Mob* mob) {}
|
||||
|
||||
virtual void OnMobDamage(MobPtr target, float damage, Tower* damager) {}
|
||||
virtual void OnMobDamage(Mob* target, float damage, Tower* damager) {}
|
||||
|
||||
virtual void OnMobTouchCastle(Mob* damager, TeamCastle* enemyCastle) {}
|
||||
virtual void OnMobCastleDamage(Mob* damager, TeamCastle* enemyCastle, float damage) {}
|
||||
|
||||
@@ -222,7 +222,9 @@ public:
|
||||
|
||||
// MobListener
|
||||
|
||||
virtual void OnMobDamage(MobPtr target, float damage, Tower* source);
|
||||
virtual void OnMobDamage(Mob* target, float damage, Tower* source);
|
||||
|
||||
virtual void OnMobDie(Mob* mob);
|
||||
private:
|
||||
void tickMobs(std::uint64_t delta);
|
||||
void cleanDeadMobs();
|
||||
|
||||
Reference in New Issue
Block a user