You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
1 month ago
|
|
||
|
using System;
|
||
|
using System.Runtime.CompilerServices;
|
||
|
using Entitas;
|
||
|
using Entitas.CodeGeneration.Attributes;
|
||
|
|
||
|
|
||
|
namespace CoreGame.Render
|
||
|
{
|
||
|
// todo : 可能存在多种触发器
|
||
|
public abstract class EffectTriggerBase
|
||
|
{
|
||
|
public EffectTriggerType TriggerType { get; protected set; }
|
||
|
public int buffEid;
|
||
|
public Action<NotifyBase> m_TriggerCallback;
|
||
|
public NotifyType NotifyType { get; protected set; }
|
||
|
public bool isTriggered = false;
|
||
|
public bool canTrigger = false;
|
||
|
public float lastCd = 0;
|
||
|
public float cd = 0;
|
||
|
public int triggeredCnt = 0;
|
||
|
|
||
|
public void SetNotifyType(NotifyType notifyType)
|
||
|
{
|
||
|
NotifyType = notifyType;
|
||
|
}
|
||
|
|
||
|
public abstract bool IsSatisfied();
|
||
|
public abstract void ExecuteTrigger(NotifyType notifyType, NotifyBase notify);
|
||
|
|
||
|
public virtual void OnTrigger(NotifyType notifyType, NotifyBase notify)
|
||
|
{
|
||
|
m_TriggerCallback?.Invoke(notify);
|
||
|
}
|
||
|
|
||
|
public virtual void SetTriggered()
|
||
|
{
|
||
|
isTriggered = true;
|
||
|
canTrigger = false;
|
||
|
lastCd = cd;
|
||
|
triggeredCnt++;
|
||
|
}
|
||
|
}
|
||
|
}
|