private void GetNextWayPoint() { if (headingToWaypoint) { //int randomSpawnCount = Random.Range(1, 4); int i = 0; while (i < 5) { waveSpawner.SpawnEnemy(target.transform, waveIndex); i++; } if (currentNumSpawned >= maxNumSpawnBeforeReset) { int r = Random.Range(0, desertWaypoints.Length); target = desertWaypoints[r]; currentNumSpawned = 0; } currentNumSpawned++; headingToWaypoint = false; } else { headingToWaypoint = true; int r = Random.Range(0, Waypoints.waypoints.Length - 11); target = Waypoints.waypoints[r]; waveIndex = r; } }
private IEnumerator NextBloodMoonEvent(float secondsUntil) { yield return(new WaitForSeconds(secondsUntil)); // Action station, action station // Blood moon might be happening soon, give out alerts, man the stations BloodMoonAdvancedWarning?.Invoke(advancedWarningTime); audioSourceWarning.Play(); yield return(new WaitForSeconds(advancedWarningTime)); // Too late, blood moon is now happening audioSourceBloodMoon.Play(); BloodMoonAlert?.Invoke(); if (enemies != null && enemies.Length > 0) { for (var i = 0; i < bloodMoonEnemies; ++i) { var index = Random.Range(0, enemies.Length); waveSpawner.SpawnEnemy(enemies[index]); } } CancelBloodMoon(); }