/// <summary> /// For each point, spawn enemies and return the list of all spawned enemies /// </summary> /// <returns>List of all spawned enemies</returns> public List <TDS_Enemy> GetWaveEnemies(TDS_SpawnerArea _owner) { List <TDS_Enemy> _enemies = new List <TDS_Enemy>(); foreach (TDS_SpawnPoint _point in spawnPoints) { _enemies.AddRange(_point.GetSpawningEnemies(_owner)); } return(_enemies); }
/// <summary> /// Get all enemies resources Names /// Instantiate them and set their owner as the spawner area that owns this SpawnPoint /// return the list of all spawned enemies /// </summary> /// <param name="_owner">TDS_SpawnerArea that owns the spawn point</param> /// <returns>List of spawned enemies</returns> public List <TDS_Enemy> GetSpawningEnemies(TDS_SpawnerArea _owner) { // Get enemies from the wave Element List <string> _enemiesNames = waveElement.GetInformations(); //Create the list of spawned Enemies for this spawn point List <TDS_Enemy> _spawnedEnemies = new List <TDS_Enemy>(); // Spawn every enemies from thoses informations TDS_Enemy _e; for (int i = 0; i < _enemiesNames.Count; i++) { _e = PhotonNetwork.Instantiate(_enemiesNames[i], GetRandomSpawnPosition(), Quaternion.identity, 0).GetComponent <TDS_Enemy>(); _e.Area = _owner; _spawnedEnemies.Add(_e); } return(_spawnedEnemies); }
/// <summary> /// Make MrLoyal gets out of the battle, then make him call the cats at a rate /// </summary> /// <returns></returns> public IEnumerator GetOutOfBattle() { /// Call the particle here TDS_VFXManager.Instance.SpawnEffect(FXType.MrLoyalTeleportation, transform.position); /// Then wait some time and teleport Mr Loyal on his plateform yield return(new WaitForSeconds(1.25f)); sprite.enabled = false; transform.position = teleportationPosition; TDS_VFXManager.Instance.SpawnEffect(FXType.MrLoyalEndTeleportation, teleportationPosition); yield return(null); sprite.enabled = true; yield return(new WaitForSeconds(1f)); /// Instantiate again particles on the teleportation spot TDS_SpawnerArea _currentArea = linkedAreas.Where(a => !a.IsDesactivated).FirstOrDefault(); if (!_currentArea) { yield return(GetBackIntoBattle()); yield break; } _currentArea.OnNextWave.AddListener(CallOut); _currentArea.StartSpawnArea(); yield return(null); CallOut(); float _timer = 0; while (!_currentArea.IsDesactivated) { yield return(null); _timer += Time.deltaTime; if (_timer > chargeCatsRate) { cats.ToList().ForEach(c => c.ActivateCat()); PlayCallOutSound("Cat"); _timer = 0; } } yield return(GetBackIntoBattle()); }