private void Awake() { coroutineRunner = Instantiate(CoroutineRunnerPrefab) .GetComponent <ICoroutineRunner>(); ObjectPoool objectPoool = new ObjectPoool(meteorPrefab, PoolRootTransform, optimumPoolCount); CreateShip(); MeteorSpawner meteorSpawner = new MeteorSpawner(meteorPrefab, spawnTime, minMeteoSpeed, maxMeteoSpeed, xMapConstraint, -xMapConstraint, yMapConstraint, -yMapConstraint, 0.01f, coroutineRunner, objectPoool); }
public MeteorSpawner(GameObject meteorPrefab, float spawnTime, float minMeteoSpeed, float maxMeteoSpeed, float xSpawn, float xMin, float yMax, float yMin, float timeSpeedUp, ICoroutineRunner coroutineRunner, ObjectPoool objectPoool) { this.meteorPrefab = meteorPrefab; this.spawnTime = spawnTime; this.minMeteoSpeed = minMeteoSpeed; this.maxMeteoSpeed = maxMeteoSpeed; this.xSpawn = xSpawn; this.yMax = yMax; this.yMin = yMin; this.xMin = xMin; this.timeSpeedUp = timeSpeedUp; this.coroutineRunner = coroutineRunner; this.objectPoool = objectPoool; coroutineRunner.StartCoroutine(SpawnMeteosInLoop()); }