protected IEnumerator spawnEnemySpawners() { for (int i = 0; i < mapDimension.x; i++) { for (int j = 0; j < mapDimension.y; j++) { Vector3 spawnPosition = tileInstances[i][j].transform.position + new Vector3(Random.Range(1f, tileDimension.x - 1), 0f, Random.Range(1f, tileDimension.y - 1)); if (Random.Range(0f, 1f) < getTileDistanceRatioFromCenter(i, j)) { enemySpawnerInstances.Add(Instantiate(enemySpawner, spawnPosition, Quaternion.identity)); } } updateLoading(.6f + (float)i / mapDimension.x * .1f); yield return(null); } ItemTurnerOnAndOffer jeff = gameObject.GetComponent <ItemTurnerOnAndOffer>(); if (jeff != null) { foreach (GameObject obj in enemySpawnerInstances) { EnemySpawner es = obj.GetComponent <EnemySpawner>(); if (es != null) { es.init(jeff); } } } }
public void init(ItemTurnerOnAndOffer jeff) { enemyInstances = new List <GameObject>(); itemTurnerOnAndOffer = jeff; }