// Start is called before the first frame update public void SpawnControlStart() { // variable initialization according to GameControl maxLanes = gameControl.GetMaxLanes(); maxUnits = gameControl.GetMaxUnits(); // data structure initializations InitLaneCoords(); InitStage(); // initialize combat control combatControl.InitCombatControl(); currentCreature = friendlyCreatureList[0].GetComponent <DefaultCreature>(); // summon friendly and hostile base SummonBase(); }
// push creature called when a creature is spawned in a certain lane public void PushCreature(int laneNum, GameControl.Sides side, DefaultCreature newCreature) { if (side == GameControl.Sides.Friendly) { lock (lock_friendlyLanes) { //add the newCreature to friendly lanes in current laneNum friendlyLanes.creatureList[laneNum].Add(newCreature); } } else { lock (lock_hostileLanes) { //add the newCreature to hostile lanes in current laneNum hostileLanes.creatureList[laneNum].Add(newCreature); } } }
//pop creature called when a creature died in a certain lane public void PopCreature(int laneNum, GameControl.Sides side, DefaultCreature deadCreature) { spawnControl.OnUnitDeath(); if (side == GameControl.Sides.Friendly) { //remove the deadCreature to friendly lanes in current laneNum lock (lock_friendlyLanes) { //remove the deadCreature to friendly lanes in current laneNum friendlyLanes.creatureList[laneNum].Remove(deadCreature); } } else { lock (lock_hostileLanes) { // remove the deadCreature to hostile lanes in current laneNum hostileLanes.creatureList[laneNum].Remove(deadCreature); } } }