示例#1
0
 void Update()
 {
     GameObject[] balls = GameObject.FindGameObjectsWithTag("Ball");
     if (balls.Length == 1)
     {
         Win(playerScore.GetScore());
     }
 }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        PlayerScore ps = player.GetComponent <PlayerScore> ();

        if (ps != null)
        {
            scoreLabel.text = ps.GetScore().ToString("0");
        }
    }
示例#3
0
    public void GameOver()
    {
        if (gameOver)
        {
            return;
        }

        gameOver       = true;
        Time.timeScale = 0f;
        customCursor.Disable();
        gameUI.SetActive(false);

        PlayerScore player = FindObjectOfType <PlayerScore>();

        if (highScoreManager.isHighScore(player.GetScore(), timer))
        {
            newHighScoreScreen.Setup(player.GetScore(), timer);
            return;
        }

        LoadGameOverScreen(true);
    }
示例#4
0
    public void displayGameOverMenu()
    {
        ucm.RefreshlastMouseCoordinate();

        PlayerScore ps = player.GetComponent <PlayerScore> ();

        if (ps != null)
        {
            // set last player score
            scoreGameOverLabel.text = "SCORE: " + ps.GetScore().ToString("0");
        }

        // display game over menu
        gameObject.SetActive(true);

        // Set first button selected
        eventSystem.SetSelectedGameObject(null); //Resetting the currently selected GO
        eventSystem.SetSelectedGameObject(firstButtonSelected);
    }
示例#5
0
    void SortPlayersByScore()
    {
        for (int i = 0; i < players.Length - 1; i++)
        {
            PlayerController current_player = players [i];
            PlayerScore      player_score   = current_player.GetComponent <PlayerScore> ();
            int current_score = player_score.GetScore();
            int j             = i;
            int next_score    = players [j + 1].GetComponent <PlayerScore> ().GetScore();


            while (j < players.Length - 1 && next_score > current_score)
            {
                players [j] = players [j + 1];
                j++;
            }

            players [j] = current_player;
        }
    }
示例#6
0
    private void OnTriggerEnter(Collider other)
    {
        int[] score = _scoreManager.GetScore();

        // If enemy ship gets through the gate update score
        if (_tag == _gateTags[1] && other.tag == _enemyTags[0])
        {
            int scorePlayer1 = score[0] + 1;
            _scoreManager.UpdateScore(new int[2] {
                scorePlayer1, score[1]
            });
            Destroy(other.gameObject);
        }
        else if (_tag == _gateTags[0] && other.tag == _enemyTags[1])
        {
            int scorePlayer2 = score[1] + 1;
            _scoreManager.UpdateScore(new int[2] {
                score[0], scorePlayer2
            });
            Destroy(other.gameObject);
        }
    }
示例#7
0
    // Update is called once per frame

    void Update()
    {
        scoreText.text = score.GetScore().ToString();
    }
示例#8
0
 private void Die()
 {
     playerMovement.canMove = false;
     playerAudio.Die();
     gameOverManager.GameOver(playerScore.GetScore());
 }
示例#9
0
 private void Start()
 {
     score.SetScore();
     scoreText.text = "Picked Up: " + score.GetScore().GetValue(0).ToString() + "/" + score.GetScore().GetValue(1).ToString();
 }
示例#10
0
 public float GetUIScore()
 {
     return(_playerScore.GetScore());
 }