Please help…
My scenario is display CustomerA(prefab) which have a timer script in object, after i click a CustomerA, it’s will destroy and display againt CustomerA in random time and timer countdown againt from beginning…
I already create a script called CustomerTimer.cs which attached to CustomerA to make countdown timer in it
CustomerTimer.cs
private void Update ()
{
if(!stopTime)
{
countDownTime();
}
}
private void countDownTime()
{
timesRemaining = startingCountDownTimer - Time.time;
percent = timesRemaining / startingCountDownTimer * 100;//calculate percent
setSprite(percent);//if percent is 0 then object will be destroy automaticly
}
Object will be destroy if i click on an object and object will be appear again in random time.
For example
if starting count down from 45 second and object destroy at second 20 (timesRemaining = 45-20 = 15) then after object respawn again a new game object timesRemaining will be start from 15 because Time.time is not reset from 1 again
Can i reset a Time.time but in one game object only ?
I know the problem but i don’t know how to solve it…
Sorry for my bad English…
Thanks