Im using this code at the moment:
function Shoot(seconds)
{
if(Vector3.Distance(transform.position, target.position) < range)
{
if(seconds!=savedTime)
{
var bullet = Instantiate(bulletPrefab, transform.Find("enemySpawnPoint").transform.position,Quaternion.identity);
bullet.rigidbody.AddForce(transform.forward * 800);
savedTime=seconds;
}
}
}
And the point is to get my enemies to fire a burst of 50 shots for 1 second. Then have a break for 10 seconds. Then do same again. Is this code correct for that?
Can someone help me make a simple script for that?