I have this timer code byt read 300, 299 etc when counting down. Is there a quick fix so it appears like so 3:00.
// the textfield to update the time to private var textfield:GUIText; // time variables public var allowedTime:int = 300; var currentTime = allowedTime; function Awake() { // retrieve the GUIText Component and set the text textfield = GetComponent(GUIText); UpdateTimerText(); // start the timer ticking TimerTick(); } function UpdateTimerText() { // update the textfield textfield.text = currentTime.ToString(); } function TimerTick() { // while there are seconds left while(currentTime > 0) { // wait for 1 second yield WaitForSeconds(1); // reduce the time currentTime--; UpdateTimerText(); } // game over //yield WaitForSeconds (10); //Application.LoadLevel ("Menu"); }
Thanks