Example #1
0
        private static IEnumerator DelayCoroutine(float duration, AwaitableEnumerator awaitable, IScheduler scheduler)
        {
            var startTime = scheduler.Now;

            yield return(new WaitWhile(() => scheduler.Now - startTime < duration));

            awaitable.Finished();
        }
Example #2
0
        private static IEnumerator PlayCoroutine <T>(IAnimator <T> animator, ITranslator <T> translator, AwaitableEnumerator awaitable, IScheduler scheduler)
        {
            var startTime = scheduler.Now;

            while (true)
            {
                var t = animator.Update(scheduler.Now - startTime);
                translator.Update(t.Item1);
                if (t.Item2)
                {
                    break;
                }
                yield return(null);
            }
            awaitable.Finished();
        }