示例#1
0
        public void UpdateRollOneScore(RollOneScore rollOneScore)
        {
            var frame       = GetFrame(rollOneScore.FrameNumber);
            var playerScore = GetPlayerScore(frame, rollOneScore.PlayerId);

            UpdateRollOne(rollOneScore, playerScore);
            if (frame.FrameNumber > 1 && frame.FrameNumber < 11)
            {
                PlayerScore previousFramePlayerScore = GetPreviousFramePlayerScore(rollOneScore, frame);
                if (previousFramePlayerScore.FirstRoll.WasStrike && playerScore.FirstRoll.WasStrike)
                {
                    previousFramePlayerScore.TotalPoints += 10;
                    playerScore.TotalPoints += previousFramePlayerScore.TotalPoints;
                }
                if (previousFramePlayerScore.SecondRoll.WasSpare)
                {
                    previousFramePlayerScore.TotalPoints += rollOneScore.NumberOfPinsKnockedDown;
                    playerScore.TotalPoints += previousFramePlayerScore.TotalPoints;
                }
            }
            playerScore.TotalPoints += rollOneScore.NumberOfPinsKnockedDown;
        }
示例#2
0
 private void UpdateRollOne(RollOneScore rollOneScore, PlayerScore playerScore)
 {
     playerScore.FirstRoll.Points    = rollOneScore.NumberOfPinsKnockedDown;
     playerScore.FirstRoll.WasStrike = rollOneScore.WasStrike;
 }