public void InstantiateUnitsOfType(UnitsArrayAndCounter units, int unitsCount) { units.arraySpawnUnits = new BaseUnit[10]; for (int i = 0; i < unitsCount; i++) { GameObject unit = Instantiate(units.prefab); units.arraySpawnUnits[i] = unit.GetComponent<BaseUnit>(); units.arraySpawnUnits[i].SetActiveObject(false); } }
public void InstantiateUnitsOfType(UnitsArrayAndCounter units, int unitsCount) { units.arraySpawnUnits = new BaseUnit[10]; for (int i = 0; i < unitsCount; i++) { GameObject unit = Instantiate(units.prefab); units.arraySpawnUnits[i] = unit.GetComponent <BaseUnit>(); units.arraySpawnUnits[i].SetActiveObject(false); } }
public void SpawnUnitToStartPos(Vector3 spawnPosition, UnitsArrayAndCounter arrayWithSpawnUnit) { BaseUnit[] units = arrayWithSpawnUnit.arraySpawnUnits; if (arrayWithSpawnUnit.counter < units.Length) { units[arrayWithSpawnUnit.counter].StartFromSpawnPosition(spawnPosition); arrayWithSpawnUnit.counter++; } else { arrayWithSpawnUnit.counter = 0; SpawnUnitToStartPos(spawnPosition, arrayWithSpawnUnit); } }