Ok so i am trying to get my machine gun to have some shooting delay. I’ve used yeild wate for seconds but its not what i want. This is the effect i want http://www.youtube.com/watch?v=uzoMcbpxil0
See how his machine gun has like a .1 second delay? well mine just shoots a solid line of bullets, which is obvoisly bad. So how would i add a delay, if i’m using getmousedown Heres my code.
var bullitPrefab : Transform;
var Delay : int = .3;
function Update () {
if (Input.GetMouseButton(0)){
Shoot();
}
}
function Shoot(){
yield WaitForSeconds(Delay);
var bullit = Instantiate(bullitPrefab ,transform.Find("spawnPoint").transform.position ,
Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 1000);
}