This commit is contained in:
aozhiwei 2023-03-17 14:56:52 +08:00
parent 454cec3425
commit 51521ff10f
2 changed files with 57 additions and 1 deletions

View File

@ -15,9 +15,56 @@
void CondAddBuff::Activate() void CondAddBuff::Activate()
{ {
switch ((CondAddBuff_e)meta->_int_buff_param1) {
case CondAddBuff_e::kBulletHit:
{
ProcBulletHit();
}
break;
case CondAddBuff_e::kBulletKill:
{
ProcBulletKill();
}
break;
case CondAddBuff_e::kBulletEnd:
{
ProcBulletEnd();
}
break;
}
} }
void CondAddBuff::Deactivate() void CondAddBuff::Deactivate()
{
for (auto handler : handlers_) {
if (!handler.expired()) {
owner->GetTrigger()->RemoveEventHandler(handler);
}
}
handlers_.clear();
}
void CondAddBuff::ProcBulletHit()
{
handlers_.push_back
(
owner->GetTrigger()->AddListener
(
kBulletHitEvent,
[] (const a8::Args& args)
{
})
);
}
void CondAddBuff::ProcBulletKill()
{
}
void CondAddBuff::ProcBulletEnd()
{ {
} }

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "buff.h" #include "buff.h"
#include "trigger.h"
A8_DECLARE_CLASS_ENUM(CondAddBuff_e, int, A8_DECLARE_CLASS_ENUM(CondAddBuff_e, int,
kBulletHit = 11, kBulletHit = 11,
@ -17,4 +17,13 @@ class CondAddBuff : public Buff
virtual void Activate() override; virtual void Activate() override;
virtual void Deactivate() override; virtual void Deactivate() override;
private:
void ProcBulletHit();
void ProcBulletKill();
void ProcBulletEnd();
private:
std::vector<std::weak_ptr<EventHandlerPtr>> handlers_;
}; };