private void Awake() { instance = this; if (PlayerPrefs.HasKey("bestKillStreak")) { //we had a previous session totalKills = PlayerPrefs.GetInt("totalKills"); totalDeaths = PlayerPrefs.GetInt("totalDeaths"); killDeathRatio = PlayerPrefs.GetFloat("killDeathRatio"); totalHits = PlayerPrefs.GetInt("totalHits"); totalMisses = PlayerPrefs.GetInt("totalMisses"); accuracy = PlayerPrefs.GetInt("accuracy"); currentLevel = PlayerPrefs.GetInt("currentLevelIndex"); bestKillStreak = PlayerPrefs.GetInt("bestKillStreak"); highScore = PlayerPrefs.GetInt("highScore"); } else { //we have a new game Save(); } }
public void removeLife() { if (!isGameOver) { hearts [numLives - 1].GetComponent <heart> ().dead = true; numLives--; } if (numLives == 0) { gameStats currentStats = gameStats.GetComponent <gameStats> (); currentStats.finalWC = wordManager.GetComponent <WordManager> ().wordCounters; currentStats.gameComplete(); isGameOver = true; } }