public void GameOver() { // check if it's a new record if (levelManager.TotalDistance > RecordDistance) { RecordDistance = levelManager.TotalDistance; } // add the credits collected this race to the player inventory TotalCredits += creditsThisRace; // cancel any active powerups, we don't want them to still be running when we restart. PowerupManager.CancelAllPowerups(); state = GameState.Dead; menuSystem.HUD.Hide(); SoundManager.PauseMusic(0.2f); // pause then show the restart menu. Invoke("OnEnterStateDeath", 1.0f); }