diff options
Diffstat (limited to 'Assets/Scripts/AbilitySystem/Trigger.cs')
-rw-r--r-- | Assets/Scripts/AbilitySystem/Trigger.cs | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/Assets/Scripts/AbilitySystem/Trigger.cs b/Assets/Scripts/AbilitySystem/Trigger.cs deleted file mode 100644 index 70a6d0f4..00000000 --- a/Assets/Scripts/AbilitySystem/Trigger.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public enum TriggerOnlyOnce -{ - Off = 0, - On = 1, -} - -public enum TriggerSwallow -{ - Off = 0, - On = 1 -} - - -/// <summary> -/// 不同效果的trigger继承这个基类 -/// </summary> - -public sealed class Trigger -{ - private TriggerSwallow m_Swallow; - public bool Swallow - { - get - { - return m_Swallow == TriggerSwallow.On; - } - } - - private ConditionBase m_Condition; - private List<ActionBase> m_ActionChain = new List<ActionBase>(); - - public Trigger(ConditionBase condition, List<ActionBase> actions, TriggerOnlyOnce onlyOnce = TriggerOnlyOnce.Off, TriggerSwallow swallow = TriggerSwallow.On) - { - m_Swallow = swallow; - m_Condition = condition; - m_ActionChain.AddRange(actions); - } - public Trigger(ConditionBase condition, ActionBase action, TriggerOnlyOnce onlyOnce = TriggerOnlyOnce.Off, TriggerSwallow swallow = TriggerSwallow.On) - { - m_Swallow = swallow; - m_Condition = condition; - m_ActionChain.Add(action); - } - - //重置触发器的参数 - public void Reset() - { - - } - - /// <summary> - /// 如果触发执行了,返回true,否则返回false - /// </summary> - /// <returns></returns> - public bool Update() - { - if (m_Condition.Evaluate()) - { - foreach(var action in m_ActionChain) - { - action.Execute(); - } - return true; - } - return false; - } - -}
\ No newline at end of file |