i want my countdown timer to execute do my condition everytime it meets the condition… here us my code…
var startTime = 30.0;
var timer: GameObject;
var intTime;
function Update()
{
//start of problem
//this condition is my problem… every time the time is <=10; i want my the time to a add 20 seconds. It works properly but only once… when the time added 20 seconds it will not repeat the condition…
timeTaken = startTime - Time.time;
if (timeTaken <= 10.0)
{
timeTaken += 20.0;
}
timer.guiText.text = FormatTime (timeTaken);
}
//end of problem
function FormatTime (time)
{
intTime = time;
var minutes : int = intTime / 60;
var seconds : int = intTime % 60;
var fraction : int = time * 10;
fraction = fraction % 10;
timeText = minutes.ToString () + “:”;
timeText = timeText + seconds.ToString ();
timeText += “:” + fraction.ToString ();
return timeText;
}