Пример #1
0
        public ISceneState Advance(TimeSpan elapsedTime)
        {
            if (levelCollection.ShouldChangeLevel())
            {
                return(new LevelTransitionState(levelCollection, levelRenderer));
            }

            var input = inputStateManager.Advance(elapsedTime);

            if (input != InputAction.None)
            {
                inputBuffer.Enqueue(input);
            }

            if (commandRunner.AdvanceAction(levelCollection.CurrentLevel, elapsedTime) || inputBuffer.Count == 0)
            {
                return(this);
            }

            var nextInput = inputBuffer.Dequeue();

            commandRunner.BeginAction(nextInput, levelCollection.CurrentLevel);
            commandRunner.AdvanceAction(levelCollection.CurrentLevel, elapsedTime);
            return(this);
        }