This commit is contained in:
aozhiwei 2022-10-04 18:12:26 +08:00
parent 710a56228a
commit 29ec288c9c
2 changed files with 9 additions and 0 deletions

View File

@ -418,3 +418,8 @@ void Trigger::DispatchEvent(int event_id, const std::vector<std::any>& param)
} }
} }
} }
void Trigger::BulletHit(Bullet* bullet)
{
DispatchEvent(kBulletHit, {bullet});
}

View File

@ -28,12 +28,14 @@ enum EventId_e
kShieldDestoryEvent = 5, kShieldDestoryEvent = 5,
kFlyHookPullEvent = 6, kFlyHookPullEvent = 6,
kRescueEvent = 7, kRescueEvent = 7,
kBulletHit = 8
}; };
class Weapon; class Weapon;
class Creature; class Creature;
class Skill; class Skill;
class Buff; class Buff;
class Bullet;
class Trigger class Trigger
{ {
public: public:
@ -52,6 +54,8 @@ public:
void Die(); void Die();
void ActiveBuff(MetaData::Buff* buff_meta); void ActiveBuff(MetaData::Buff* buff_meta);
void DeactiveBuff(MetaData::Buff* buff_meta); void DeactiveBuff(MetaData::Buff* buff_meta);
void BulletHit(Bullet* bullet);
std::weak_ptr<EventHandlerPtr> AddListener(int event_id, CommonCbProc cb); std::weak_ptr<EventHandlerPtr> AddListener(int event_id, CommonCbProc cb);
void RemoveEventHandler(std::weak_ptr<EventHandlerPtr> handler_ptr); void RemoveEventHandler(std::weak_ptr<EventHandlerPtr> handler_ptr);