// Update is called once per frame void Update() { CheckGameOver(); //If the game is over and the state isn't the restart screen, set it to restart if (gameOver && stateManager.currentState != GameStateManager.GameState.restart) { stateManager.newState = GameStateManager.GameState.restart; //Increase the amount of wins the player has if (winner) { winner.GetComponent <Player>().wins++; PAM.PlayCelebrate(); } } //If the new state is the game, and the game is over, respawn players and state a new round if (gameOver && stateManager.newState == GameStateManager.GameState.game) { //If the winning player won enough, end the game if (winner && winner.GetComponent <Player>().wins >= winsNeeded) { stateManager.newState = GameStateManager.GameState.mainMenu; SceneManager.LoadScene(0); } RespawnPlayers(); gameOver = false; } if (stateManager.currentState == GameStateManager.GameState.restart) { if (restartScreen) { restartScreen.SetActive(true); UpdateRestartScreen(); } } else { if (restartScreen) { restartScreen.SetActive(false); } } }