hi i got this script that spawns 5 cars every 0.8 seconds but i want them to spawn faster and faster after time so maybe after every 20 seconds the the 5 cars spawn every 0.7 seconds and i want it to stop to accelerate when it is 0.4 please help me i am having big trouble with this, here is my script:
public GameObject[] Cars;
int carNo;
public float delayTimer = 1f;
float Timer;
void Start () {
Timer = delayTimer;
}
void Update () {
Timer -= Time.deltaTime;
if (Timer <= 0)
{
Vector3 carPos = new Vector3(Random.Range(-2.2f, 2.2f), transform.position.y, transform.position.z);
carNo = Random.Range(0,5);
Instantiate(Cars[carNo], carPos, transform.rotation);
Timer = delayTimer;
}
}
↧