void OnTriggerEnter(Collider col) { if (col.transform.tag == "commandInLine") { DifficultyControlBehaviour diffControl = GameControlBehaviour.instance.GetComponent <DifficultyControlBehaviour>(); SpawnBehaviour spawnBehaviour = GameControlBehaviour.instance.GetComponent <SpawnBehaviour>(); GameObject infoTrain = GameControlBehaviour.instance.infoTrain; Debug.Log("Triggered Reching Base Event"); Vector3 parkPos = spawnBehaviour.getPositionInPark(); Vector3 outsidePos = spawnBehaviour.getPositionOnFrame(); diffControl.cycleCount++; if (diffControl.cycleCount % diffControl.cyclesForChange == 0) { spawnBehaviour.Spawn(outsidePos, parkPos); diffControl.changeSpeedBy(GetComponent <DOTweenPath>(), 0.03f); if (spawnBehaviour.zombiesInAction > infoTrain.transform.childCount) { diffControl.addSatelite(); } else if (spawnBehaviour.zombiesInAction < infoTrain.transform.childCount) { diffControl.destroyLastSatelite(); } } } }
private IEnumerator SpawnObjectRoutine(SpawnObject spawnObject) { for (int i = 0; i < spawnObject.amount; i++) { yield return(new WaitForSeconds(spawnObject.delay)); spawnBehaviour.Spawn(spawnObject.prefab); } }
private IEnumerator SpawnWaves() { WaitForSeconds waveDelay = new WaitForSeconds(delay); foreach (WaveData wave in waves) { WaitForSeconds memberDelay = new WaitForSeconds(wave.Delay); foreach (GameObject member in wave.Sequence) { Transform pointToSpawn = spawnPoints[Utilities.GetRandomIndex(0, spawnPoints.Count)]; spawnBehaviour.Spawn(member, pointToSpawn.position); yield return(memberDelay); } yield return(waveDelay); } }