//Decrement of OneSquadUnit List <UnitCounter> GetOneSquadUnits()//value - value of this squad in this wave { List <UnitCounter> unitList = new List <UnitCounter>(); for (int i = 0; i < units.Count; i++) { UnitCounter unitData = new UnitCounter(); int rand = Random.Range(units[i].MinNum, units[i].MaxNum + 1); if (rand == 0) { continue; } else { unitData.enemyUnit = units[i].unitData; unitData.num = (int)rand; unitList.Add(unitData); } } if (unitList.Count > 0) { return(unitList); } else { return(null); } }
public void SpawnUnit(UnitCounter enemyUnit, Transform spawnPoint) { GameObject unit = PoolManager.instance.Instantiate(enemyUnit.enemyUnit.prefab, spawnPoint.position, spawnPoint.rotation, false);//Instantiate<GameObject>(enemyUnit.enemyUnit.prefab); unit.transform.SetParent(spawnPoint); if (AuxiliarySystem.CompareTags(unit.tag, registeredTagsInEnemyManager)) { EnemyManager.instance.OnUnitSpawn(unit); } unit.SetActive(true); //aatttt }