public void SwitchGameState(GameState newState) { var shouldStartMusic = false; switch (newState) { case GameState.Menu: case GameState.Pause: // Disable buttons SetButtonState(false); // Show tutorial tutorialPanel.SetActive(true); audioManager.StopAllFuses(); break; case GameState.Play: SetButtonState(true); tutorialPanel.SetActive(false); SwitchToNewCharacter(); if (currentGameState == GameState.Menu) { scoringSystem.UpdateLevelNames(maxReachedLevel); levelBanner.AnimateBanner(currentLevel.GetLevelName()); shouldStartMusic = true; } break; case GameState.Credits: SetButtonState(false); screenShake.StrongShake(); endGameManager.TriggerEndCredits(); audioManager.StopAllAmbiances(); audioManager.StopAllFuses(); shouldStartMusic = true; break; } currentGameState = newState; if (shouldStartMusic) { audioManager.PlayMusic(currentLevel, currentGameState); } }