예제 #1
0
 public void RunTaskImmediately(CharacterTask task)
 {
     BreakQueue();
     currentRunnable = task;
     currentRunnable.Run();
     isUpdateTick = true;
 }
예제 #2
0
 public void BreakQueue()
 {
     isUpdateTick = false;
     characterTasks.Clear();
     if (currentRunnable != null)
     {
         currentRunnable.Interupt();
     }
     currentRunnable = null;
 }
예제 #3
0
 public void TaskEndJob(CharacterTask task)
 {
     //Debug.Log("Task End: " + task + "Queue size: " + characterTasks.Count);
     if (characterTasks.Count > 0)
     {
         currentRunnable = characterTasks.Dequeue();
         currentRunnable.Run();
     }
     else if (isUpdateTick)
     {
         isUpdateTick    = false;
         currentRunnable = null;
     }
 }
예제 #4
0
 public void RunQueue()
 {
     if (currentRunnable != null)
     {
         currentRunnable.Interupt();
         isUpdateTick = true;
         return;
     }
     //Debug.Log("Run Queue, size: " + characterTasks.Count + "tasks: ");
     //foreach (var x in characterTasks)
     //{
     //    Debug.Log(x);
     //}
     currentRunnable = characterTasks.Dequeue();
     currentRunnable.Run();
     isUpdateTick = true;
 }
예제 #5
0
 public void AddTask(CharacterTask task)
 {
     characterTasks.Enqueue(task);
 }