40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using cfg.BuffCfg;
|
|
using UnityEngine;
|
|
namespace Gameplay.Buff
|
|
{
|
|
public class BuffClearDBuff : BaseBuff
|
|
{
|
|
|
|
protected override void _OnTrigger()
|
|
{
|
|
base._OnTrigger();
|
|
|
|
var clearCount = Mathf.RoundToInt(configData.FloatParams[0]);
|
|
if (clearCount < 1) return;
|
|
var totalBuff = owner.buffManager.totalBuffList;
|
|
for (int i = 0; i < totalBuff.Count; i++)
|
|
{
|
|
var buff = totalBuff[i];
|
|
if (buff == this)
|
|
{
|
|
continue;
|
|
}
|
|
if (buff.needRemove)
|
|
{
|
|
continue;
|
|
}
|
|
if (buff.configData.BuffEffectType == EBuffEffectType.NegativeBuff)
|
|
{
|
|
clearCount--;
|
|
owner.buffManager.AddNeedRemoveBuff(buff);
|
|
if (clearCount == 0)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|