- Home /
Waves go too high after certain time
I have a certain amount of time set for my wave's to go off, and here's the code for it:
if(Time.time >= 1) {
currentWave += 1;
}
Then it just keeps on going up and up, I want it to go off after a second and stop, then go off again. If you don't understand what I mean, like I want it to go off after a second, then stop directly after it, then go off after a second, then stop.
Answer by Graham-Dunnett · Jul 18, 2014 at 08:59 PM
time is greater than one all the time one second after the game starts. When the game starts, start a timer. When it reaches one, do your wave, then set the timer back to zero.
"It just keeps going and going". Yeah, time tends to do that...
Yep. We're going round in circles somewhat... you did read @GrahamDunnett's answer, didn't you?
For the clueless, here is a code version of the answer.
private float startTime = 1.0f;
private void Wave(){
if(Time.time >= startTime) {
currentWave += 1;
startTime = Time.time +1;
}
}
Your answer
Follow this Question
Related Questions
Unity how to find load time? 1 Answer
creating a timed function 3 Answers
How to realize accurate time counter (millisecond precision) 3 Answers
How to check if no buttons are pressed for a specific time? 2 Answers
Timer Countdown fix. 2 Answers