I'm working on an FPS gun script, and i took the "reload" function from the script in the FPS tutotrial.
function Reload () {
yield WaitForSeconds(reloadTime);
if (clips > 0) {
clips--;
bulletsLeft = bulletsPerClip;
}
}
I added animation.Play like this:
function Reload () {
yield WaitForSeconds(reloadTime);
if (clips > 0) {
clips--;
bulletsLeft = bulletsPerClip;
animation.Play ("Reload"); // Line added.
}
}
The problem is that it plays the animation after the "WaitForSeconds". What should I do to make the animation play within the time span?