public void SpawnUnits() { for (int i = 1; i <= unit_melee_count; i++) { if (i == 1) { if (team1) { Mob_Melee melee = unitList[0].GetComponent <Mob_Melee>(); melee.team1 = team1; Instantiate(unitList[0], spawnPos1.transform.position, spawnPos1.transform.rotation); } } else { if (team1) { Mob_Melee melee = unitList[0].GetComponent <Mob_Melee>(); melee.team1 = team1; Instantiate(unitList[0], new Vector3(spawnPos1.transform.position.x + i, spawnPos1.transform.position.y, spawnPos1.transform.position.z), spawnPos1.transform.rotation); } } print(i); } for (int i = 1; i <= unit_range_count; i++) { if (i == 1) { if (team1) { Mob_Ranged ranged = unitList[1].GetComponent <Mob_Ranged>(); ranged.team1 = team1; Instantiate(unitList[1], spawnPos2.transform.position, spawnPos2.transform.rotation); } } else { if (team1) { Mob_Ranged ranged = unitList[1].GetComponent <Mob_Ranged>(); ranged.team1 = team1; Instantiate(unitList[1], new Vector3(spawnPos2.transform.position.x + i, spawnPos2.transform.position.y, spawnPos2.transform.position.z), spawnPos2.transform.rotation); } } } }
void Start() { mobRanged = GameObject.FindGameObjectWithTag("Mob").GetComponent <Mob_Ranged>(); }