void SpawnZombie(EnemySubWaveData data, GameObject enemyPrefab) { Vector3 pos = data.spawnPoint.position; // Spawn Bunnies GameObject obj = Instantiate(enemyPrefab, pos, Quaternion.identity); Enemy e = obj.GetComponent <Enemy>(); GameManager.AddEnemy(e); // Give them a crystal to attack Base b = GameManager.GetBase(CRYSTAL_COLOR.BLUE); e.SetBaseTarget(b); }
void SpawnWave(EnemySubWaveData data) { for (int i = 0; i < data.ZomBunniesPerWave; i++) { SpawnZombie(data, zomBunnyPrefab); } for (int i = 0; i < data.ZomBearsPerWave; i++) { SpawnZombie(data, zombBearPrefab); } for (int i = 0; i < data.HellephantPerWave; i++) { SpawnZombie(data, hellephantPrefab); } for (int i = 0; i < data.ClownPerWave; i++) { SpawnZombie(data, clownPrefab); } for (int i = 0; i < data.SheepPerWave; i++) { SpawnZombie(data, sheepPrefab); } }