示例#1
0
 public void OnUpdate(float dt)
 {
     if (runningActions != null && runningActions.Count > 0)
     {
         int deleteIndex = -1;
         for (int i = 0; i < runningActions.Count; i++)
         {
             AbilityActionBase act = runningActions[i];
             act.OnUpdate(dt);
             if (act.IsFinished())
             {
                 deleteIndex = i;
                 break;
             }
             if (act.IsBlock())
             {
                 break;
             }
         }
         if (deleteIndex != -1)
         {
             runningActions.RemoveAt(deleteIndex);
         }
     }
 }
示例#2
0
        public override void OnUpdate(float dt)
        {
            if (actions == null || actions.Count == 0)
            {
                bool condition = (bool)this.condition.GetValue();
                actions = new List <AbilityActionBase>(condition ? whenTrue : whenFalse);
            }

            int deleteIndex = -1;

            for (int i = 0; i < actions.Count; i++)
            {
                AbilityActionBase act = actions[i];
                act.OnUpdate(dt);
                if (act.IsFinished())
                {
                    deleteIndex = i;
                    break;
                }
                if (act.IsBlock())
                {
                    break;
                }
            }
            if (deleteIndex != -1)
            {
                actions.RemoveAt(deleteIndex);
            }
        }