Пример #1
0
 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);
     }
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
    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);
        }
    }
Пример #4
0
    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);
        }
    }