My has a delay between firing so you have to wait for the animation to end before firing again. My firing animation is 0.2 seconds, how do I make the delay below 1? I have tried var fireTime : float = 0.2; But it just ignores the fire time. Here is my firing function:
var fireTime = 0.2; //This is in the list of all of my variables
function Fire() {
if(!Reloading && !Firing) {
if(MaxAmmo > 0){
if(CurrentAmmo > 0) {
if (Input.GetButtonDown("Fire1")) {
Firing=true;
Shotsfired = Shotsfired + 1;
CurrentAmmo=CurrentAmmo-1;
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
Debug.DrawRay (transform.position, transform.forward * 100);
if (Physics.Raycast (ray, hit, 100))
{
hit.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);
}
// if(Scoped == false)
// {
animation.Play(FireAnimation.name);
// }
// if(Scoped == true)
// {
// animation.Play(ScopedFire.name);
// }
audio.PlayOneShot(Gunshot);
yield WaitForSeconds(fireTime);
Firing=false;
}
}
}
}
}