public void Update() { if (work > 0) { work -= Time.deltaTime; if (work <= 4 && !soundPlay) { StartCoroutine(PlayWarning()); } if (work <= 0) { AudioManager.Instance.PlaySound("Switch"); } } else if (rest > 0) { rest -= Time.deltaTime; if (rest <= 4 && !soundPlay) { StartCoroutine(PlayWarning()); } if (rest <= 0) { AudioManager.Instance.PlaySound("Switch"); } } else if (rounds > 1) { rounds--; work = defaultWork; rest = defaultRest; } else { //switch scene ScreenChanger changer = Camera.main.GetComponent <ScreenChanger>(); changer.Finish(); } int DisplaySeconds = (TimeFinished - System.DateTime.UtcNow).Seconds; int DisplayMinutes = (TimeFinished - System.DateTime.UtcNow).Minutes; TotalTime.text = DisplayMinutes.ToString("D2") + " : " + DisplaySeconds.ToString("D2"); }