void Update()
{
if (inLevel) {
if (currentSpawnTime <= 0) {
//we can spawn a weapon now
int pointIndex = Random.Range(0, spawnPointsSize); //which point we want to spawn at
int weaponIndex = Random.Range(0, weapons.Length); //what weapon we will use, however it may be disabled
GameObject.Instantiate(weapons[weaponIndex],spawnPoints[pointIndex].position, Quaternion.identity);
//reset currentSpawnTime
currentSpawnTime = Random.Range(1/spawnRate, 20/spawnRate);
} else {
//waiting for timer to go down
currentSpawnTime -= Time.deltaTime;
}
}
}