Ejemplo n.º 1
0
    // On Collision
    void OnCollisionEnter(Collision collision)
    {
        // If the colliding object is the player
        // and the player's colour state is the same as this one
        if (collision.gameObject.CompareTag("Player"))
        {
            if (currentColourState == player.getCurrentColourState())
            {
                player.reverseMovement();

                if (opositePaddle)
                {
                    collisionAudioSource.playSound();
                    spawnParticleEffect();
                    disablePaddle();
                    opositePaddle.selectNewColourState();
                }
            }

            else
            {
                ScoreTargetController.setCanGenerateScoreTarget(false);
                StartCoroutine(GameStateController.endGame());
            }
        }
    }
Ejemplo n.º 2
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());
        }
    }