예제 #1
0
파일: BaseNPC.cs 프로젝트: floatyears/CodeX
    //---------技能系统逻辑----------//
    public void TriggerAbilityEvent(AbilityEventType eType)
    {
        int count = abilities.Count;

        for (int i = 0; i < count; i++)
        {
            abilities[i].TriggerEvent(eType);
        }
    }
예제 #2
0
 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());
     }
 }
예제 #3
0
    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());
            }
        }
    }
예제 #4
0
    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();
            }
        }
    }