//physicScheduler -> updateScheduler -> coroutineScheduler -> lateScheduler

        internal static void KillSchedulers()
        {
            if (_multiThreadScheduler != null)
            {
                _multiThreadScheduler.Dispose();
            }
            _multiThreadScheduler = null;

#if UNITY_5 || UNITY_5_3_OR_NEWER
            if (_coroutineScheduler != null)
            {
                _coroutineScheduler.Dispose();
            }
            if (_physicScheduler != null)
            {
                _physicScheduler.Dispose();
            }
            if (_lateScheduler != null)
            {
                _lateScheduler.Dispose();
            }
            if (_updateScheduler != null)
            {
                _updateScheduler.Dispose();
            }

            _coroutineScheduler = null;
            _physicScheduler    = null;
            _lateScheduler      = null;
            _updateScheduler    = null;
#endif
        }
Пример #2
0
    public void TestCoroutineMonoRunnerStartsTheFirstIterationImmediately()
    {
        var testFirstInstruction = TestFirstInstruction();
        var runner = new CoroutineMonoRunner("test4");

        testFirstInstruction.RunOnScheduler(runner);
        runner.Dispose();

        Assert.That(testFirstInstruction.Current, Is.EqualTo(1));
    }
Пример #3
0
    public IEnumerator TestUnityWait()
    {
        var coroutineMonoRunner = new CoroutineMonoRunner("test1");
        ITaskRoutine <IEnumerator> taskRoutine = TaskRunner.Instance.AllocateNewTaskRoutine(coroutineMonoRunner);

        taskRoutine.SetEnumeratorProvider(new WaitForSecondsUnity().GetEnumerator);


        taskRoutine.Start();
        DateTime then = DateTime.Now;

        while (taskRoutine.isRunning == true)
        {
            yield return(null);
        }
        coroutineMonoRunner.Dispose();
        var totalSeconds = (DateTime.Now - then).TotalSeconds;

        Assert.That(totalSeconds, Is.InRange(0.9, 1.1));
    }