public void SetText(Difficulty difficulty, float time, int errors) { _difficulty.text = "Difficulty: " + difficulty.ToString(); _time.text = "Time: " + StatManager.FormatTime(time); _errors.text = errors.ToString() + " errors"; gameObject.SetActive(true); }
internal void SetData(StatType stat, Difficulty SelectedDifficulty) { _label.text = stat.Label + ":"; if (stat.DataType == statTypesEnum.Int) { _data.text = PlayerPrefs.GetInt(StatManager.GenerateStatKey(stat, SelectedDifficulty)).ToString(); } else if (stat.DataType == statTypesEnum.Float) { _data.text = StatManager.FormatTime(PlayerPrefs.GetFloat(StatManager.GenerateStatKey(stat, SelectedDifficulty))); } }
/// <summary> /// Corouting to display the timer for the current game /// </summary> /// <returns></returns> private IEnumerator Timer() { //records the exact start time of the game startTime = Time.time; //the interval that the clock is updated in the ui float timmingInterval = 0.01f; Debug.Log("Starting Timer"); while (true) { _timer.text = StatManager.FormatTime(Time.time - startTime); yield return(new WaitForSeconds(timmingInterval)); } }