Adding a variable to an object in an array.

I am trying to build a spawn manager. I want to have multiple rounds in my game, for each round I want to assign multiple enemies that spawn. Each enemy type needs a variable for the number of enemies it needs to spawn. Is there a way to add a “count” variable to set a number of particular objects to spawn within an array?

for example

var round1enemies : GameObject[];
var round2enemies : GameObject[];

I want each gameObject inside of the array to have a variable for the count. So if I select two different types of enemies for the first round, I can spawn 10 of enemy 1 and 20 of enemy two, things like that. Can arrays be expanded upon like this?

will the number be constant no matter the round?

If so use enumeration.

example of that roughly (not ran through an editor to see if it compiles)

public enum AmountPerType { goblins = 10, hobgoblins = 20, dogs = 1, giants = 44};

var round1enemies : array;


round1enemies = new array();


function addhobgoblins(EnemiesArray : array) {

for(int counter = 0; counter < AmountPerType.hobgoblins; counter++)
{
 EnemiesArray.add(instantiate(hobgoblinprefab));
}

//you shouldn't instantiate because all 20 or
// whatever objects will have the same rotations
// and everything thing i just did it here
// for an exmaple
//You should have ANOTHER FUNCTION
//it should modify the spawn in 
//a logical way and return the object you spawned
//that will make it instantiate and return it
//so its stored in the array.

if you need more help give more detail. I’m not writing a bunch of code for what might be the solution. :stuck_out_tongue: