namespace Marro.PacManUdon
{
    public partial class GameManager
    {
        private void TimeSequenceStepPacManCaught(int sequenceProgress)
        {
            switch (sequenceProgress)
            {
                case 0:
                    // Freeze (except for the ghost animations)
                    SetFrozen(true, ghostKeepAnimating: true);
                    soundManager.StopAllSound();
                    break;
                case 1:
                    // Hide ghosts, start pacman death animation
                    SetGhostsActive(false);
                    pacMan.Die();
                    break;
                case 2:
                    // Start playing death sound
                    soundManager.PlayDeathSound();
                    break;
                case 3:
                    // Hide pacman
                    SetPacManActive(false);
                    break;
            }
        }

        private void TimeSequenceFinishedPacManCaught()
        {
            PacManTimeSequence nextSequence;
            if (gameState == PacManGameState.AttractModeDemo)
            {
                nextSequence = PacManTimeSequence.AttractScreenWaitToRestart;
            }
            else if (extraLives > 0)
            {
                nextSequence = PacManTimeSequence.RestartLevel;
            }
            else
            {
                nextSequence = PacManTimeSequence.GameOver;
            }
            
            StartTimeSequence(nextSequence);
        }
    }
}
