void SpawnEnemy() { enemiesToSpawn--; difficulty += difficultyIncreasement; simultaneousEnemyCount += 1.5f * difficultyIncreasement; Vector3 random = new Vector3(Random.Range(-randomRadius, randomRadius), Random.Range(-randomRadius, randomRadius), Random.Range(-randomRadius, randomRadius)); Vector3 spawnPos = mustang.position + spawnDistance * mustang.forward + spawnHeight * mustang.up + random; GameObject ufo = Instantiate(ufoPrefab, spawnPos, Quaternion.identity, transform); Destroy(Instantiate(spawnEffect, ufo.transform, false), 5.0f); FlightAI flightAI = ufo.GetComponent <FlightAI>(); UfoAI ufoAI = ufo.GetComponent <UfoAI>(); // Adjust flight AI properties flightAI.follow = mustang; flightAI.movementSpeed *= difficulty; flightAI.basicTurnSpeed *= difficulty; // Adjust ufo AI properties ufoAI.player = mustang.GetComponent <Player>(); ufoAI.target = mustang.GetComponentInChildren <Camera>().transform.parent; ufoAI.health *= difficulty; //ufoAI.lightDamage *= difficulty; ufoAI.lightAimSpeed *= difficulty; Debug.Log(ufo.name + " spawned"); }
void SpawnEndBoss() { GameData.Instance.objective = "Rescue Ray Rice by defeating the boss"; Vector3 random = new Vector3(Random.Range(-randomRadius, randomRadius), Random.Range(-randomRadius, randomRadius), Random.Range(-randomRadius, randomRadius)); GameObject boss = Instantiate(bossPrefab, mustang.position + 2 * spawnDistance * mustang.forward + spawnHeight * mustang.up + random, Quaternion.identity, transform); FlightAI flightAI = boss.GetComponent <FlightAI>(); UfoAI ufoAI = boss.GetComponent <UfoAI>(); // Adjust flight AI properties flightAI.follow = mustang; // Adjust ufo AI properties ufoAI.player = mustang.GetComponent <Player>(); ufoAI.target = mustang.GetComponentInChildren <Camera>().transform.parent; }