public WeatherServiceTests() { _mockWeatherEndpoint = new Mock <IWeatherEndpoint>(); _dummyWeatherResponse = new WeatherForecastResponse { ConsolidatedWeather = new List <Weather> { new Weather { WeatherStateName = "Dummy WeatherStateName", ApplicableDate = "2020-05-30", WeatherStateAbbr = "Dummy WeatherStateAbbr" } } }; _dummyAreaInformation = new AreaInformation { Title = "Dummy Title", Woeid = 1, LattLong = "Dummy LattLong", LocationType = "Dummy LocationType" }; }
public IEnumerator SpawnEnemies() { for (int currentWave = 0; currentWave < waves.Length; currentWave++) { photonView.RPC("DisplayInfo", PhotonTargets.All, currentWave + 1); List <GameObject> currentlySpawned = new List <GameObject>(); AreaInformation area = areas[waves[currentWave].area]; int currentspawner = Random.Range(0, area.spawnpoints.Length); int spawned = 0; int spawnAmount = Random.Range(waveHordeSize.x, waveHordeSize.y); for (int i = 0; i < waves[currentWave].spawnAmount; i++) { while (currentlySpawned.Count >= areas[waves[currentWave].area].maxEnemies) { for (int enemy = 0; enemy < currentlySpawned.Count; enemy++) { if (currentlySpawned[enemy].GetComponent <BaseEnemy>().health <= 0) { currentlySpawned.RemoveAt(enemy); enemy--; photonView.RPC("DisplayInfo", PhotonTargets.All, currentlySpawned.Count.ToString() + " Alive"); } } yield return(null); } if (spawned >= spawnAmount) { currentspawner = Random.Range(0, area.spawnpoints.Length); spawned = 0; spawnAmount = Random.Range(waveHordeSize.x, waveHordeSize.y); yield return(new WaitForSeconds(hordeDelay)); } GameObject g = PhotonNetwork.Instantiate(enemy, area.spawnpoints[currentspawner].position, Quaternion.identity, 0); currentlySpawned.Add(g); spawned++; photonView.RPC("DisplayInfo", PhotonTargets.All, currentlySpawned.Count.ToString() + " Alive"); yield return(new WaitForSeconds(spawnDelay)); } while (currentlySpawned.Count > 0) { for (int enemy = 0; enemy < currentlySpawned.Count; enemy++) { if (currentlySpawned[enemy].GetComponent <BaseEnemy>().health <= 0) { currentlySpawned.RemoveAt(enemy); enemy--; photonView.RPC("DisplayInfo", PhotonTargets.All, currentlySpawned.Count.ToString() + " Alive"); } } yield return(null); } for (float i = 0; i < waveDelay; i += Time.deltaTime) { Vector2Int returnTime = RecalculateTime(waveDelay - i); photonView.RPC("DisplayInfo", PhotonTargets.All, returnTime.x + ":" + ((returnTime.y < 10)? "0" : "") + returnTime.y); yield return(null); } } }