Exemple #1
0
        /// <summary>
        /// Start the specified coroutine on specified job runner.
        /// </summary>
        /// <param name="coroutine">Coroutine.</param>
        /// <param name="jobRunner">Job runner.</param>
        public static CoroutineJob Start(IEnumerator coroutine, CoroutineJobRunner jobRunner)
        {
            CoroutineJob job = CoroutineJob.Create(coroutine);

            job.Start(jobRunner);
            return(job);
        }
        public CoroutineJobRunnerTracker(CoroutineJobRunner runner)
        {
            runner.OnDestroyed += OnRunnerDestroyed;
            m_runnerId          = runner.ID;

            CoroutineJob.OnBroadcastJobStarted   += HandleOnBroadcastJobStarted;
            CoroutineJob.OnBroadcastJobCompleted += HandleOnBroadcastJobCompleted;
            CoroutineJob.OnBroadcastJobKilled    += HandleOnBroadcastJobKilled;
        }
        public void DestroyRunner(string id)
        {
            if (runners.ContainsKey(id))
            {
                CoroutineJobRunner coroutineJobRunner = runners[id];
                GameObject.Destroy(coroutineJobRunner.gameObject);

                runners[id] = null;
                runners.Remove(id);
            }
        }
 public CoroutineJobRunner CreateRunner(string id, bool ddol)
 {
     if (!runners.ContainsKey(id))
     {
         GameObject runnerObj = new GameObject("cjr_" + id);
         if (ddol)
         {
             GameObject.DontDestroyOnLoad(runnerObj);
         }
         CoroutineJobRunner coroutineJobRunner = runnerObj.AddComponent <CoroutineJobRunner>();
         coroutineJobRunner.Init(id);
         runners.Add(id, coroutineJobRunner);
     }
     return(runners[id]);
 }
Exemple #5
0
        public void Start(CoroutineJobRunner jobRunner)
        {
            if (!running)
            {
                if (jobRunner.Initialized)
                {
                    running = true;
                    killed  = false;

                    runnerId = jobRunner.ID;

                    jobRunner.StartCoroutine(Run());
                }
                else
                {
                    RaiseOnJobStartError();
                }
            }
        }