NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Buff/Impl/BuffStatus.cs

45 lines
1.2 KiB
C#

using cfg.BuffCfg;
using Framework;
namespace Gameplay.Buff
{
public abstract class BuffStatus: BaseBuff
{
protected override void _OnAdd()
{
base._OnAdd();
// 判断是否有混乱的buff
var hasBuff = owner.buffManager.CheckHasBuffType(buffType);
if (hasBuff)
{
return;
}
// 设置标记
_SetStatus();
// 发送事件
EventManager.Instance.Send(EventManager.EventName.INFIGHT_STATUS_CHANGED, owner);
}
protected abstract void _SetStatus();
protected abstract void _UnSetStatus();
protected override void _OnRemove()
{
base._OnRemove();
// 判断除自己外是否还有混乱的buff
var hasBuff = owner.buffManager.CheckHasBuffTypeExcept(buffType, this);
if (hasBuff)
{
return;
}
// 取消标记
_UnSetStatus();
// 发送事件
EventManager.Instance.Send(EventManager.EventName.INFIGHT_STATUS_CHANGED, owner);
}
}
}