public void TriggerEvent(ModifierEventType eType) { List <BaseAction> actions; if (isOrb) { switch (eType) { case ModifierEventType.OnAttack: eType = ModifierEventType.Orb; break; case ModifierEventType.OnAttackStart: eType = ModifierEventType.OnOrbFire; break; case ModifierEventType.OnAttackLanded: eType = ModifierEventType.OnOrbImpact; break; } } if (eventActions.TryGetValue(eType, out actions)) { int count = actions.Count; for (int i = 0; i < count; i++) { actions[i].Execute(); } } }
public void TriggerModifierEvent(ModifierEventType eType) { int count = modifiers.Count; for (int i = 0; i < count; i++) { modifiers[i].TriggerEvent(eType); } }
public void RegisterEvent(ModifierEventType 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(ModifierEventType 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()); } } }