I need some help with a script I am trying to write.
I'd like to cycle through this array of gameobjects, activating the next enemy in the array every X seconds.
The problem is this:
-for loop spawns x number of enemies after x seconds.
-player kills enemy[1]
-for loop spawns enemy[1], instead of the next enemy in the array
How do I make the loop continue through the objects, before starting back at the beginning?
var Enemies : GameObject[];
var totalEnemies : int;
totalEnemies = 10;
var Player : Transform;
function Spawner()
{
for(var i=0;i < totalEnemies; i++)
{
yield WaitForSeconds(5);
Enemies*.active = true;*
_Enemies*.transform.position = Player.position;*_
_*}*_
_*}*_
_*```*_
_*<p>Thanks for any input!</p>*_