void BackToMainMenu() { if (WaveManager.GetWaveNumber() > PlayerPrefs.GetInt("Highest Wave Reached", 0)) { PlayerPrefs.SetInt("Highest Wave Reached", WaveManager.GetWaveNumber()); PlayerPrefs.SetInt("Highest Hero_1", GlobalVariable.GetPlayerHeroID(1)); PlayerPrefs.SetInt("Highest Hero_2", GlobalVariable.GetPlayerHeroID(2)); PlayerPrefs.SetInt("Highest Hero_3", GlobalVariable.GetPlayerHeroID(3)); } if (WaveManager.GetGoldEarned() > PlayerPrefs.GetInt("Most Gold Earned", 0)) { PlayerPrefs.SetInt("Most Gold Earned", WaveManager.GetGoldEarned()); } if (WaveManager.GetKillCount() > PlayerPrefs.GetInt("Most Kills", 0)) { PlayerPrefs.SetInt("Most Kills", WaveManager.GetKillCount()); } GlobalVariable.AddPlayerGold(WaveManager.GetGoldEarned()); SceneManager.LoadScene("MainMenu"); }