// Increase the bounce count public void increaseBounceCount() { // If the colour switch count is less than 2 if (colourSwitchCount < 2) { // Add 2 to the player's score setBounceCount(getBounceCount() + 2); // Spawn the alert text hudLayerController.getGameplayHUDLayer().printAlertText("Switch Bonus"); } // Otherwise else { // Add 1 to the player's score setBounceCount(getBounceCount() + 1); } colourSwitchCount = 0; hudLayerController.getGameplayHUDLayer().updateHUDElements(); // If the bounce count is equal to the target if (bounceCount >= ScoreTargetController.getScoreTarget()) { // End the game ScoreTargetController.setCanGenerateScoreTarget(true); PlayerStatsContainer.setWins(PlayerStatsContainer.getWins() + 1); StartCoroutine(GameStateController.endGame()); } }
void Awake() { playerStatsContainer = GetComponent <PlayerStatsContainer>(); waypointContainer = GameObject.FindWithTag("WaypointContainer").GetComponent <WaypointContainer>(); gamecontroller = GameObject.FindWithTag("GameController").GetComponent <GameController>(); anim = GetComponent <Animator>(); }
// Generate score target public static void generateScoreTarget() { if (canGenerateScoreTarget == true) { scoreTarget = Random.Range(minScoreTarget, maxScoreTarget); // Add to the score target based on the current round scoreTarget += scoreIncreaseModifier * (PlayerStatsContainer.getWins()); } }
private void GetValues() { // Get Values Player1Stats = p1.GetComponent <PlayerStatsContainer>(); Player2Stats = p2.GetComponent <PlayerStatsContainer>(); Player1Waypoint = Player1Stats.currentWaypoint; Player2Waypoint = Player2Stats.currentWaypoint; Player1Pos = p1.transform.position; Player2Pos = p2.transform.position; }
// Show this layer public void show() { Cursor.visible = true; toolTipText.text = string.Empty; animComp.SetBool("isShowing", true); // Add on click listener quitButton.onClick.AddListener(delegate { musicPlayer.fadeOut(); StartCoroutine(transitionToMainMenu()); }); winsText.text = PlayerStatsContainer.getWins().ToString() + " / " + StageSystemManager.getFinalStage().ToString(); rankText.text = StageSystemManager.getPlayerRank(PlayerStatsContainer.getWins()); }
// Start the game private IEnumerator startGame() { float startDelay = 2.5f; welcomeScreen_hide(); currentScreenIndicator.gameObject.SetActive(false); loadingText.gameObject.SetActive(true); background.enabled = false; StageSystemManager.resetValues(); ScoreTargetController.resetValues(); PlayerStatsContainer.resetValues(); yield return(new WaitForSeconds(1.0f)); fadeImageAnimator.SetBool("isShowing", true); yield return(new WaitForSeconds(startDelay)); SceneManager.LoadSceneAsync("Scene_GameArea_Sanctuary"); }
// Start the game private IEnumerator startGame() { float delay = 2.0f; hide(); PlayerStatsContainer.resetValues(); StageSystemManager.resetValues(); ScoreTargetController.resetValues(); Cursor.visible = false; loadingText.gameObject.SetActive(true); yield return(new WaitForSeconds(delay)); fadeImage.SetBool("isShowing", true); yield return(new WaitForSeconds(2.5f)); SceneManager.LoadSceneAsync("Scene_GameArea_Sanctuary"); }
void UpdateLeaderboardDisplay() { for (int i = 0; i < Players.Length; i++) { PlayerStatsContainer playerstats = PlayersSorted[i].GetComponent <PlayerStatsContainer>(); TextMeshProUGUI text = playerstats.LeaderboardDisplay.GetComponentInChildren <TextMeshProUGUI>(); text.text = i + 1 + "."; text.color = LeaderboardColors[3]; switch (i) { case 0: text.color = LeaderboardColors[0]; break; case 1: text.color = LeaderboardColors[1]; break; case 2: text.color = LeaderboardColors[2]; break; } } }