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)); } }
void ReturnBigUnitToPool(BigUnit unit) { bigUnitPool.UnRent(unit); unit.gameObject.SetActive(false); }
protected void SetDependency <TDependency>(TDependency dependency) { BigUnit.SetDependency(dependency); }
protected TDependency GetDependency <TDependency>() { return(BigUnit.GetDependency <TDependency>()); }
protected TTestInstance GetTestInstance <TTestInstance>() { return(BigUnit.GetTestInstance <TTestInstance>()); }