- Home /
Question by
Xatoku · Apr 02, 2011 at 09:27 PM ·
buttonprojectileshoot
Shooting Animation
I've set up my character so that if I press "e" on the keyboard, he'll do an animation to pull out his gun, and then he'll go to the following script to shoot. My question is when he shoots, he shoots like crazy and creates way too many bullets. Is there a way to reduce the amount of bullets made? Preferably 1 every time the below script restarts?
function ARShot(){
while(shootingAR == true){
animation.CrossFade("ARShootStraight", 0.1);
yield WaitForSeconds(.1);
var assaultShot = Instantiate(assaultBullet, GameObject.Find("assaultBulletSpawn").transform.position, transform.rotation);
assaultShot.rigidbody.AddForce(transform.forward * 10000);
yield WaitForSeconds(.3);
}
}
Comment