Beispiel #1
0
    // 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());
        }
    }
Beispiel #2
0
    // When this HUD layer is shown
    public void show()
    {
        Cursor.visible   = true;
        tooltipText.text = string.Empty;

        continueButton.onClick.AddListener(delegate
        {
            // If the player is not on the last stage
            // Increase the stage count
            if (StageSystemManager.isOnFinalStage() == false)
            {
                StageSystemManager.setCurrentStage(StageSystemManager.getCurrentStage() + 1);
            }
            musicPlayer.fadeOut();
            StartCoroutine(reloadLevel());
        });

        quitButton.onClick.AddListener(delegate
        {
            musicPlayer.fadeOut();
            StartCoroutine(goToMainMenu());
        });

        // Set the content of the title based on whether the player
        // reached the score target
        if (player.getBounceCount() >= ScoreTargetController.getScoreTarget())
        {
            titleText.text = "You Win";
        }

        else
        {
            titleText.text = "You Lose";
        }

        scoreGoalText.text          = ScoreTargetController.getScoreTarget().ToString();
        playerBounceResultText.text = player.getBounceCount().ToString();

        animComp.SetBool("isShowing", true);
        animComp.SetBool("isHiding", false);
    }
Beispiel #3
0
 // Update HUD elements
 public void updateHUDElements()
 {
     bounceCountText.text = player.getBounceCount().ToString();
     targetText.text      = ScoreTargetController.getScoreTarget().ToString();
 }