Exemplo n.º 1
0
 private void updateScore(BallBehavior ballDropped)
 {
     if (!ballDropped.IsWhite())
     {
         //points++;
         points += COLOURED_BALL_PTS;
     }
     else
     {
         //points--;
         points += WHITE_BALL_PTS;
         ballDropped.Reset();
     }
 }
    private void OnCollisionEnter(Collision collider)
    {
        BallBehavior script = collider.collider.GetComponent <BallBehavior>();

        if (script != null)
        {
            if (script.team != -1 && script.team != this.team)
            {
                scoreManager.UpdateScore(script.team, 1);
                script.Reset();
                scoreManager.UpdateHealth(this, -1);
                scoreManager.TempFreeze();
            }
        }
    }
Exemplo n.º 3
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.tag != "Ball")
     {
         return;             //don't do anything if it's not the ball
     }
     // Increment variable to keep track of score
     if (this.tag == "BlueGoal")
     {
         ++scoreObject.redScore;             //increment RedScore
     }
     else if (this.tag == "RedGoal")
     {
         ++scoreObject.blueScore;             //increment BlueScore
     }
     //reset ball
     ballObject.Reset();
 }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        score.text = CountingScore().ToString();

        if (CountingBallLeft().Equals(1) && started)
        {
            //Reset score
            points     = 0;
            score.text = points.ToString();

            //Reset game
            startNewGame();
            whiteBall.Reset();
        }

        if (CountingBallLeft().Equals(MAX_BALLS))
        {
            started = true;
        }
    }