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"); }
public IEnumerator StartEndGameLeaderboard(int tempScore) { firebaseController.retrieveLeaderboardOnFirebase(); guicontroller.hideCanvas(); score = tempScore; guicontroller.addCenterText("Score: " + score); //this.hideLeaderboard (); yield return(new WaitForSeconds(4.0f)); SceneManager.LoadScene(SceneManager.GetActiveScene().name); /* * this.showLeaderboard (); * * scoreObj.SetActive (true); * scoreObj.GetComponent<TextMesh> ().text = "Score: " + score; * * if (isFirebase) { * if (isEntryHighScore (tempScore)) { * // Input Name for new highscore * // When Input complete, * // show score * // show main menu button * * nameInputObj.SetActive (true); * leaderboardName.GetComponent<TextMesh> ().text = leaderboardNameString; * * while(!isInputName) * { * yield return new WaitForSeconds(0.5f); * } * * nameInputObj.SetActive (false); * * string leaderboardText = ""; * for (int i = 1; i <= 10; i++) { * leaderboardText += i + ": " + leaderboard [i - 1].name + " | " + leaderboard [i - 1].score + "\n"; * } * * leaderboardTitleObj.SetActive (true); * leaderboardObj.SetActive (true); * leaderboardObj.GetComponent<TextMesh> ().text = leaderboardText; * returnToMainMenuObj.SetActive(true); * } else { * // Show score * // Show highscore list * // Show Main menu button * * string leaderboardText = ""; * * for (int i = 1; i <= 10; i++) { * leaderboardText += i + ": " + leaderboard [i - 1].name + " | " + leaderboard [i - 1].score + "\n"; * } * * leaderboardTitleObj.SetActive (true); * leaderboardObj.SetActive (true); * leaderboardObj.GetComponent<TextMesh> ().text = leaderboardText; * returnToMainMenuObj.SetActive(true); * } * } else { * // Show unable to get high score list * // Prompt return to main menu only * unavailableObj.SetActive(true); * returnToMainMenuObj.SetActive (true); * } * */ }