//this will figure out which pins are knocked over and use that to determine the score
    public void TalleyScore()
    {
        int score = 0;

        for (int i = 0; i < pins.Count; i++)
        {
            float angle = Vector3.Dot(Vector3.up, pins[i].transform.up);
            if (angle <= 0.9f)//if a pin falls past this angle, it counts as one point
            {
                score++;
            }
        }
        print(score);
        bowlingCheckListItem.Score = score; //used for adding score to scoreboard
        bowlingCheckListItem.OnBowlingScored();
    }
Beispiel #2
0
    public void TalleyScore()
    {
        score = 0;

        for (int i = 0; i < pins.Count; i++)
        {
            float angle = Vector3.Dot(Vector3.up, pins[i].transform.up);

            if (angle <= 0.9f)
            {
                score++;
            }
        }

        bowlingCheckListItem.Score = score;
        bowlingCheckListItem.OnBowlingScored();
    }
Beispiel #3
0
    public void TalleyScore()
    {
        //Integer variable "score" created to store the value for the amount of pins knocked over
        //Score set to 0 at the start of function to prevent previous score from being carried over
        int score = 0;

        //For loop checks each pin's "up" angle and the game world's "up" angle using the Dot function
        //If the pin's angle is less than 0.9f (world up angle), then it is fallen over and a score is added
        //The score is printed in the console after the for loop
        for (int i = 0; i < pins.Count; i++)
        {
            float angle = Vector3.Dot(Vector3.up, pins[i].transform.up);
            if (angle < 0.9f)
            {
                score++;
            }
        }
        //Set the score to the BowlingCheckListItem's "Score" property
        //Call the OnBowlingScored function from the BowlingCheckListItem class
        bowlingCheckListItem.Score = score;
        bowlingCheckListItem.OnBowlingScored();
    }