private void SpawnMinionWave() { //GameObject objectToSpawn = _availableEnemyPrefabs[UnityEngine.Random.Range(0, _availableEnemyPrefabs.Count)]; WaveManager.WavePredictionAI waveData = WaveManager.GetCurrentWave(); GameObject objectToSpawn = waveData._aitype._aiObjectReference; bool isEnhanced = WaveManager.GetChanceOfEnhancedAI(); int toSpawnCount = _waveSize.Random; for (int i = 0; i < toSpawnCount; i++) { Vector3 spawnPos = _spawnLocation.position + (Vector3.up * objectToSpawn.transform.localScale.y * 1.1f) * i; GameObject waveObject = Instantiate(objectToSpawn, spawnPos, _spawnLocation.rotation); Enemy_AI aiRef = waveObject.GetComponent <Enemy_AI>(); if (aiRef == null) { Debug.LogErrorFormat(waveObject, "Could not find reference to 'AI' script on object {0}", waveObject.name); continue; } aiRef.InitialiseAI(new object[] { spawnPos }, waveData._combatType); if (isEnhanced) { Debug.Log("I am enhancing DA AI"); aiRef.EnhanceAI(); } } }
private void SpawnBossWave() { WaveManager.WavePredictionAI?bossType = WaveManager.GetCurrentBossWave(); if (bossType == null) { return; } GameObject bossToSpawn = bossType.Value._aitype._aiObjectReference; Vector3 spawnPos = _spawnLocation.position + (Vector3.up * bossToSpawn.transform.localScale.y * 1.1f); GameObject bossObj = Instantiate(bossToSpawn, spawnPos, _spawnLocation.rotation); Enemy_AI aiRef = bossObj.GetComponent <Enemy_AI>(); if (aiRef == null) { Debug.LogErrorFormat(bossObj, "Could not find reference to 'AI' script on object {0}", bossObj.name); } else { // Passing in NULL for Combat Type because its already assigned within the Boss specifically aiRef.InitialiseAI(new object[] { spawnPos }, null); } }