/// <summary> /// Manages all the things that need to change between levels. /// Note that the first level is started from the MyPlayersManager class, when both controllers have been detected. /// </summary> public void MoveToNextLevel() { currentLevelIndex++; if (currentLevelIndex % powerupEveryXLevels == 0) { PowerupManager.Instance.SpawnPowerups(spawnPer); } if (currentLevelIndex >= levelInfos.Length) { Debug.Log("All levels complete"); return; } currentLevelInfo = levelInfos[currentLevelIndex]; // Add Scrap to ShipTotal repair shipScrapCollected += currentScrapCount; currentScrapCount = 0; ShipPartiallyRepaired?.Invoke(); if (shipScrapCollected >= ShipScrapTotalRequired) { EndGame(true); return; } //Update Game Progress UI UIManager.Instance.ShipRepairStatusText.SetText($"Ship Health : {shipScrapCollected}/{ShipScrapTotalRequired}"); UIManager.Instance.ScrapTotalText.SetText($"Scrap: 0"); UIManager.Instance.WaveInfoText.SetText($"Wave: {currentLevelInfo.LevelNo}"); Debug.Log($"Wave {currentLevelInfo.LevelNo} spawing"); //Spawn Next Wave of Enemies currentEnemyCount = currentLevelInfo.NoEnemiesToSpawn; enemySpawnController.SpawnEnemies(currentEnemyCount); }
public void spawnEnemy(int amount) { spawner.SpawnEnemies(amount); }