- Home /
Problem with Time.time
So I'm trying to write a reloading script. Here's what I got:
if (ammo <= 0) reloading = true;
if (reloading == true)
{
if (ammo <= 0 && Time.time > newclip)
{
newclip = Time.time + reloadtime;
ammo = 8;
}
}
The problem is is that the timer starts as soon as I fire the first shot not after the last one. Any solutions?
First, you don't need the reloading == true, you can just have reloading; however, I don't know what the problem is, I'm wondering if you could just use a yield WaitForSeconds(); to pause, or a yield ReloadAnimation(); to play the reload animation (In that function)... I'm sure someone more experienced can help you further, but if no one answers, try what I said, it'll help you a little, I'd expect.
Your answer
Follow this Question
Related Questions
How to Count quited(program off) time 1 Answer
Time does not start counting down when need to 1 Answer
How Would I Change This To Read Within A Time Range? 1 Answer
Timer reset 1 Answer
Can screen Timeout be achieved at a particular time? 0 Answers