Пример #1
0
    public IEnumerator SpawnUnit()
    {
        while (true)
        {
            //would be fun to make a random enemy spawn, rather than always std >>> big.
            //if there is time...
            //would also be nice if they turned to the front...
            if (allUnitsSpawned == false)
            {
                if (currentStdUnitNr < maxStdUnitNr)
                {
                    StandardUnit stdUnit = stdUnitPool.Rent() as StandardUnit;
                    SetUpUnit(stdUnit);
                    currentStdUnitNr++;
                }

                else if (currentBigUnitNr < maxBigUnitNr)
                {
                    BigUnit bigUnit = bigUnitPool.Rent() as BigUnit;
                    SetUpUnit(bigUnit);
                    currentBigUnitNr++;
                }
            }

            if (currentStdUnitNr == maxStdUnitNr && currentBigUnitNr == maxBigUnitNr)
            {
                allUnitsSpawned = true;

                //Making sure all targets are gone before starting next wave.
                if (TowerBase.targets.Count == 0)
                {
                    if (currentWave != maxWaves)
                    {
                        currentWave++;
                        StartWave();
                        yield break;
                    }
                    else
                    {
                        GameManager.StartNextLevel();
                    }
                }
            }

            yield return(new WaitForSeconds(spawnTimer));
        }
    }
Пример #2
0
 void ReturnBigUnitToPool(BigUnit unit)
 {
     bigUnitPool.UnRent(unit);
     unit.gameObject.SetActive(false);
 }
Пример #3
0
 protected void SetDependency <TDependency>(TDependency dependency)
 {
     BigUnit.SetDependency(dependency);
 }
Пример #4
0
 protected TDependency GetDependency <TDependency>()
 {
     return(BigUnit.GetDependency <TDependency>());
 }
Пример #5
0
 protected TTestInstance GetTestInstance <TTestInstance>()
 {
     return(BigUnit.GetTestInstance <TTestInstance>());
 }