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 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++; } } }