endGame() public method

public endGame ( ) : void
return void
 // Check if the player leaned in the wrong direction
 private void checkIfPlayerLeanedInWrongDirection(LanePositions laneToCheck)
 {
     // If the current target to destroy is not in the lane to check
     if (targetManager.targetToDestroy.lanePosition != laneToCheck)
     {
         print("Wrong Position!");
         gameStateController.endGame(true);
     }
 }
示例#2
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());
            }
        }
    }
示例#3
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());
        }
    }
示例#4
0
    // Run clock
    private void runClock()
    {
        currentTime--;

        // If the current time is 0
        // End the game
        if (currentTime == 0)
        {
            stopClock();
            gameStateController.endGame(false);
            print("Game ended");
        }
    }