// Update is called once per frame void Update() { if (enemySpawnSequence.Count <= 0) { return; } float currentTime = Time.time - sceneLoadTime; EnemySpawnData data = (EnemySpawnData)enemySpawnSequence[0]; if (data.isSpawnCheckpoint()) { gameData.checkpointReached(); enemySpawnSequence.RemoveAt(0); } else { float yCoordinate = determineBulletLocationWithPercentage(data.getYSpawnPercentage()); UnityEngine.Object enemyToSpawn = (UnityEngine.Object)enemyTypeList[data.getEnemyType()]; if (currentTime >= data.getLocation()) { Instantiate(enemyToSpawn, new Vector3(enemySpawnerObject.position.x, yCoordinate, enemySpawnerObject.position.z), enemySpawnerObject.rotation); enemySpawnSequence.RemoveAt(0); } } }
private void FilterSpawnToCheckpointIndex(int index) { int checkpointsReached = 0; while (enemySpawnSequence.Count >= 0) { EnemySpawnData data = (EnemySpawnData)enemySpawnSequence[0]; if (data.isSpawnCheckpoint()) { checkpointsReached++; if (checkpointsReached >= index) { sceneLoadTime -= data.getLocation(); return; } } else { enemySpawnSequence.RemoveAt(0); } } }