public void ShowScore(float time, Level currentLevel) { this.currentLevel = currentLevel; mutationPanelmover.HidePanel(); timeText.text = "Time: " + NumberConverter.FormatTimeToString(time) + "s"; float bestTime = GameManager.Instance.SaveData.bestTimes[currentLevel.levelID]; if (bestTime == 0 || time < bestTime) { GameManager.Instance.SaveData.bestTimes[currentLevel.levelID] = time; bestTimeText.color = Color.green; bestTimeText.text = "Best Time: " + NumberConverter.FormatTimeToString(time) + "s"; } else { bestTimeText.text = "Best Time: " + NumberConverter.FormatTimeToString(bestTime) + "s"; } GiveReward(time); }
private void Update() { if (timerRunning) { timeElapsed += Time.deltaTime; timeElapsedText.text = NumberConverter.FormatTimeToString(timeElapsed); } }