//---------技能系统逻辑----------// public void TriggerAbilityEvent(AbilityEventType eType) { int count = abilities.Count; for (int i = 0; i < count; i++) { abilities[i].TriggerEvent(eType); } }
public void RegisterEvent(AbilityEventType eType, BaseAction action) { if (!eventActions.ContainsKey(eType)) { eventActions.Add(eType, new List <BaseAction>()); } if (!eventActions[eType].Contains(action)) { eventActions[eType].Add(action); } else { CLog.Info("There is same action with the event type: %s", action.ToString()); } }
public void RegisterEvent(AbilityEventType eType, List <BaseAction> actions) { if (!eventActions.ContainsKey(eType)) { eventActions.Add(eType, new List <BaseAction>()); } int count = actions.Count; for (int i = 0; i < count; i++) { if (!eventActions[eType].Contains(actions[i])) { eventActions[eType].Add(actions[i]); } else { CLog.Info("There is same action with the event type: %s", actions[i].ToString()); } } }
public void TriggerEvent(AbilityEventType eType) { List <BaseAction> actions; if (eventActions.TryGetValue(eType, out actions)) { switch (eType) { case AbilityEventType.OnAbilityPhaseStart: OnAbilityPhaseStart(); break; case AbilityEventType.OnUpgrade: OnUpgrade(); break; } int count = actions.Count; for (int i = 0; i < count; i++) { actions[i].Execute(); } } }