private void SetGameState(GameState newGameState) { switch (newGameState) { case GameState.SHOW_SHOPPING_LIST: uiAction.ShowShoppingList(); gameEnvironment.gameObject.SetActive(false); timer.pauseTimer(); break; case GameState.InGame: uiAction.ShowInGame(); gameEnvironment.gameObject.SetActive(true); timer.resumeTimer(); break; case GameState.GameOver: if (currentGameState != newGameState) { gameEnvironment.gameObject.SetActive(false); uiAction.ShowGameOver(); scoreAction.gameOverLeaderBoard(); timer.pauseTimer(); } break; case GameState.Pause: uiAction.ShowPause(); timer.pauseTimer(); break; default: throw new ArgumentOutOfRangeException(nameof(newGameState), newGameState, null); } currentGameState = newGameState; OnGameStateChanged(currentGameState); }