//check the points in upper section and if bonus can be given void CheckUpperLine() { //upperPoints += line.points; if (upperPoints >= 63 && upperBonusLine.hasBeenPlayed == false) //so that the bonus points are not given mopre than once { upperBonusLine.SetOtherPoints(true); upperBonusLine.PlayThis(); GameManager.instance.playerInTurn.AddToPoints(upperBonusLine.points); } }
//line has been chosen, play it public void PlayRound() { //get the chosen line and do needed things in it Toggle chosenToggle = lineToggleGroup.ActiveToggles().FirstOrDefault(); SingleLine sl = chosenToggle.GetComponent <SingleLine>(); sl.PlayThis(); clickBlocker.SetActive(true); GameManager.instance.playerInTurn.AddToPoints(sl.points); //send points to the players score //check the upper section if needed for the upper bonus if (sl.lineType.Contains("upper")) { upperPoints += sl.points; CheckUpperLine(); upperBonusLine.UpperBonusUpdating(upperPoints); //show upper points in sheet } //if line is first yatzy if (sl.lineType == "yatzy" && !yatzyPlayed) { if (currentLineIsYatzy) { //if yatzy has been played as zero, later yatzys wont give extra 50 points yatzyZeroPoints = false; } else { yatzyZeroPoints = true; } yatzyPlayed = true; } //if line is not yatzy, but dices are the same number and yatzy has not been played as 0. so give EXTRA POINTS! else if (yatzyPlayed && !yatzyZeroPoints && currentLineIsYatzy) { GameManager.instance.playerInTurn.AddToPoints(YatzyExtraPoints); //sl.extraPoints = YatzyExtraPoints; sl.ShowExtraPoints(YatzyExtraPoints); Debug.Log("EXTRA FIDDY"); } /////// GameManager.instance.StartNextTurn(); //new round }