// Update is called once per frame void Update() { if (playing) { if (timer < 0) { playing = false; } if (!playing) { UI.EndGame(); } else { timer -= Time.deltaTime; UI.setTimer(timer); } } }