示例#1
0
 /// Creates a new Task object for the given coroutine.
 ///
 /// If autoStart is true (default) the task is automatically started
 /// upon construction.
 public CoroutineTask(IEnumerator c, bool autoStart = true)
 {
     task           = CoroutineTaskManager.CreateTask(c);
     task.Finished += TaskFinished;
     if (autoStart)
     {
         Start();
     }
 }
 public static TaskState CreateTask(IEnumerator coroutine)
 {
     if (singleton == null)
     {
         GameObject go = new GameObject("CoroutineTaskManager");
         singleton = go.AddComponent <CoroutineTaskManager>();
     }
     return(new TaskState(coroutine));
 }