IEnumerator EndGameCoroutine() { state = ROUND_STATE.END; OnGameOver(); OnRoundOver(); playerController.setPlayerSpeed(0.0f); if (roundNum >= roundMax) { guiController.addCenterText("FINISHED ALL " + roundMax + " ROUNDS!"); } else { guiController.addCenterText("Time up!"); } yield return(new WaitForSeconds(1.0f)); leaderboardManager.StartCoroutine(leaderboardManager.StartEndGameLeaderboard(points)); }
IEnumerator EndRoundCoroutine() { OnRoundOver(); state = ROUND_STATE.END; //Stop player movement if end of round playerController.setPlayerSpeed(0.0f); guiController.addCenterText("ROUND OVER"); isSpawnPowerups = false; yield return(new WaitForSeconds(1.0f)); if (roundNum < roundMax) { startRound((roundNum + 1)); } else { StartCoroutine("EndGameCoroutine"); } }
IEnumerator StartRoundCoroutine() { state = ROUND_STATE.START; guiController.addCenterText("ROUND " + roundNum); guiController.addCenterText("START!"); yield return(new WaitForSeconds(2.0f)); // Spawn powerups, animals, and animals given round number // Set Time, Animals Saved, Animals Required isSpawnPowerups = true; spawnPowerups(3); spawnAliens(roundData[roundNum - 1].aliensSpawned); spawnAnimals(roundData[roundNum - 1].animalsSpawned); this.animalsNeeded = roundData [roundNum - 1].animalsNeeded; this.animalsSaved = 0; this.timeStarted = Time.time; this.timeRoundDuration = roundData [roundNum - 1].roundDuration; this.timeEnding = timeStarted + timeRoundDuration; StartCoroutine("PlayRoundCoroutine"); }
IEnumerator PlayRoundCoroutine() { state = ROUND_STATE.PLAY; playerController.setPlayerSpeed(8.0f); yield break; }