- Home /
How to call time function once time?
Hi everybody. I making a countdown clock same as candycrush. It means that if you play over turn you will have to wait a few minutes to have next turn. My problem is when i can't not find the way to set a CDTime , it's auto update a variable from system time, so realtime will never bigger than CDTime. Please help .Me.hope to see your solution. Many thanks.
P/s: i find that when i used onclick button CDTime didn't update system time variable, but i don't want to use button.
void FixedUpdate() { turnUsed = +gameOverScript.turnPlayed; Debug.Log(turnUsed);
if (turnUsed >= turnHave)
{
}
countDown();
}
public void startCountDown()
{
System.DateTime CDDate = new System.DateTime();
CDDate = System.DateTime.Now;
CDTime = (CDDate.Hour + hours) * 60 * 60 + (CDDate.Minute + minutes) * 60 + (CDDate.Second + second);
}
public void countDown()
{
if (dayTime >= CDTime)
{
Debug.Log("endCountDown");
startCount = false;
}
else Debug.Log("noCount");
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
Invoke is not working consistently 0 Answers
Countdown timer into text c# 1 Answer