public void PlayLevel() { while (!HasWon) { var newDirection = _playerInput.TakeInput(Pacman.CurrentDirection); while (!_playerInput.HasNewInput()) { var pelletsEaten = _gameMaze.MazeArray.Cast <Tile>().Count(tile => tile.HasBeenEaten); LevelScore = Score.GetTotal(pelletsEaten); UpdateSpritePositions(newDirection); GameEngine.UpdateMazeTileDisplays(_tileTypeFactory, _gameMaze, Pacman, Ghosts); if (GameLogicValidator.HasCollidedWithGhost(Pacman, Ghosts)) { HandleDeath(); } if (LivesLeft == 0) { break; } HasWon = _gameMaze.HasEatenAllPellets(pelletsEaten); Console.Clear(); _gameMaze.Render(); _display.GameStats(LevelScore, LivesLeft); System.Threading.Thread.Sleep(TimeSpan.FromSeconds(0.2)); } if (LivesLeft != 0) { continue; } break; } }