namespace Marro.PacManUdon
{
    public partial class GameManager
    {
        private void TimeSequenceStepBoardClear(int sequenceProgress)
        {
            switch (sequenceProgress)
            {
                case 0:
                    // Freeze
                    SetFrozen(true);
                    soundManager.StopAllSound();
                    break;
                case 1:
                    // Start board blinking, hide pellets in case of rack test
                    BoardClearAnimation();
                    SetPelletsActive(false);
                    break;
                case 2:
                    // Hide ghosts
                    SetGhostsActive(false);
                    break;
                case 3:
                    // Hide maze, lives indicator, level indicator
                    SetMazeVisible(false);
                    statusDisplay.SetExtraLivesDisplayVisible(false);
                    statusDisplay.SetLevelDisplayVisible(false);
                    break;
                case 4:
                    // Hide score bar
                    statusDisplay.SetScoreDisplayVisible(false);
                    break;
                case 5:
                    // Hide pacman, show level indicator with old level
                    SetPacManActive(false);
                    statusDisplay.SetLevelDisplayVisible(true);
                    break;
                case 6:
                    break;
            }
        }

        private void TimeSequenceFinishedBoardClear()
        {
            // Call handler for what should happen next
            PacManTimeSequence nextSequence;
            switch (level)
            {
                case 2:
                    nextSequence = PacManTimeSequence.Intermission1;
                    break;
                case 5:
                    nextSequence = PacManTimeSequence.Intermission2;
                    break;
                case 9:
                case 13:
                case 17:
                    nextSequence = PacManTimeSequence.Intermission3;
                    break;
                default:
                    nextSequence = PacManTimeSequence.StartNewLevel;
                    break;
            }
            
            StartTimeSequence(nextSequence);
        }
    }
}
