private Color getRoundScoreColor(Round round) { var score = _mode.GetScore(round); if (score >= 100) { return Color.Cyan; } if (score >= 150) { return Color.Magenta; } return Color.White; }
/// <summary> /// Checks if any conditions for the awards are met and plays the award video /// </summary> public void PlayAwards(Round round) { if (!XnaDartsGame.Options.PlayAwards) { return; } if (isTonEighty(round)) { play(AwardCue.TonEighty); } else if (isThreeInTheBlack(round)) { //Play award three in the black play(AwardCue.ThreeInTheBlack); } else if (isHatTrick(round)) { //Play award hattrick! play(AwardCue.HatTrick); } else if (isHighTon(round)) { play(AwardCue.HighTon); } else if (isLowTon(round)) { //Play award low ton! play(AwardCue.LowTon); } else if (isThreeInABed(round)) { play(AwardCue.ThreeInABed); } }
private bool isTonEighty(Round round) { return round.GetScore() == 180; }
private bool isThreeInTheBlack(Round round) { return round.Darts.TrueForAll( dart => dart.Segment == 25 && dart.Multiplier == 2); }
private bool isThreeInABed(Round round) { return round.Darts.All(x => x.Segment != 0 && x.Multiplier != 1 && x.Segment == round.Darts[0].Segment && x.Multiplier == round.Darts[0].Multiplier); }
private bool isLowTon(Round round) { return round.GetScore() >= 100; }
private bool isHighTon(Round round) { return round.GetScore() > 150; }
private bool isHatTrick(Round round) { return round.Darts.TrueForAll(dart => dart.Segment == 25); }