public void AddTweenToQueue(ITweenObject tweenObject) { _queue.Enqueue(tweenObject); TweenQueueIsEmpty = false; if (_tweenQueueRunning) { return; } _tweenQueueRunning = true; StaticCoroutine.DoCoroutine(RunTweenQueue()); }
private IEnumerator RunTweenQueue() { while (_tweenQueueRunning) { if (_queue.Count == 0) { TweenQueueIsEmpty = true; yield return(null); } else { yield return(new WaitForSeconds(_timeUntilNextTween)); ITweenObject tween = _queue.Dequeue(); tween.ExecuteTween(); _timeUntilNextTween = tween.TimeUntilNextTween; yield return(new WaitForSeconds(tween.CompletionTime)); } } }