コード例 #1
0
        public override void RunRoutine()
        {
            if (isSuccess())
            {
                Reset();
                return;
            }
            currentRoutine.RunRoutine();

            if (currentRoutine.isSuccess())
            {
                if (ActiveRoutine + 1 >= AllRoutines.Count)
                {
                    Success();
                    routines = currentRoutine.GetCurrentState();
                }
                else
                {
                    ActiveRoutine++;
                    currentRoutine = AllRoutines[ActiveRoutine];
                    currentRoutine.Start();
                }
            }
            if (currentRoutine.isFailed())
            {
                Failed();
                Reset();
                return;
            }
        }
コード例 #2
0
ファイル: Repeating.cs プロジェクト: Syfrex/BehaviourTree
 public override void RunRoutine()
 {
     if (CurrentRoutine.isFailed())
     {
         Failed();
         Reset();
         return;
     }
     else if (CurrentRoutine.isSuccess())
     {
         if (RepeatTimes == 0)
         {
             Success();
             Reset();
             return;
         }
         if (RepeatTimes > 0 || RepeatTimes <= -1)
         {
             RepeatTimes--;
             CurrentRoutine.Reset();
             CurrentRoutine.Start();
         }
     }
     if (CurrentRoutine.isRunning())
     {
         CurrentRoutine.RunRoutine();
     }
 }