private void Update() { if (saveGame.RoomsCompleted() > PlayerPrefs.GetInt("highestRoomsInRun")) { PlayerPrefs.SetInt("highestRoomsInRun", saveGame.RoomsCompleted()); } if (saveGame.DeathCount() > PlayerPrefs.GetInt("highestDeathsInRun")) { PlayerPrefs.SetInt("highestDeathsInRun", saveGame.DeathCount()); } }
//get the amount of rooms completed private void OnEnable() { if (GameObject.Find("GameManager").GetComponent <SaveGame>().RoomsCompleted() != -1) { this.GetComponent <TextMeshProUGUI>().text = "Rooms completed: <b>" + saveGame.RoomsCompleted() + "</b>" + "<br>Mission failed: <b>" + saveGame.DeathCount() + "x </b>"; } }
// Update is called once per frame void Update() { if (GameObject.Find("GameManager").GetComponent <SaveGame>().RoomsCompleted() != -1) { this.GetComponent <TextMeshProUGUI>().text = "Rooms completed this run: <b>" + saveGame.RoomsCompleted() + "</b>" + "<br>Missions failed this run: <b>" + saveGame.DeathCount() + "</b>" + "<br>Total amount of rooms completed: <b>" + PlayerPrefs.GetInt("totalRoomsCompleted") + "</b>" + "<br>Total amount of missions failed: <b>" + PlayerPrefs.GetInt("totalMissionsFailed") + "</b>" + "<br>Total amount of missions failed: <b>" + PlayerPrefs.GetInt("totalMissionsFailed") + "</b>" + "<br>highest amount of missions failed in one run: <b>" + PlayerPrefs.GetInt("highestDeathsInRun") + "</b>" + "<br>highest amount of rooms in one run: <b>" + PlayerPrefs.GetInt("highestRoomsInRun") + "</b>" ; } }