I have a very basic gun script shooting 10 projectiles, but the problem is that it fires them all at once. I need some kind of rapid fire effect, so there is a short pause between each shot.
How do I do this.
//The script so far
var BulletPrefab:Transform;
var reloadTime = 0.5;
var ammoCount = 20;
private var lastShot = -10.0;
function Update()
{
if(Input.GetButtonDown("Flare"))
if (Time.time > reloadTime + lastShot && ammoCount > 0) {
for (var i : int = 0;i < 10; i++)
{
var bullet = Instantiate(BulletPrefab,
GameObject.Find("FlareSpawnPoint").transform.position,
GameObject.Find("FlareSpawnPoint").transform.rotation);
lastShot = Time.time;
ammoCount--;
}}}