/// <summary> /// Attachs a wave profile to the current enemy spawner. /// </summary> /// <param name="toAttach">To attach.</param> public void attachProfile(WaveProfile toAttach) { spawnDistance = toAttach.spawnDistance; spanwFrequency = toAttach.spanwFrequency; spawnFor = toAttach.spawnFor; whatToSpawn = toAttach.whatToSpawn; }
/// <summary> /// Commenses a horde of invaders. /// </summary> void CommenseHorde() { if (waveProfiles.waves != null && waveProfiles.waves.Count > 0 && currentWaveNumber < waveProfiles.waves.Count) { waves.Add(gameObject.AddComponent(typeof(EnemySpawner)) as EnemySpawner); WaveProfile currentProfile = waveProfiles.waves [currentWaveNumber]; waves [currentWaveNumber].enabled = true; waves [currentWaveNumber].attachProfile(currentProfile); waves [currentWaveNumber].target = hordesTargeting; waves [currentWaveNumber].id = currentWaveNumber; currentWaveNumber++; } else { this.enabled = false; } }
public EnemySpawner(WaveProfile toAttach) { attachProfile(toAttach); }