private void On(ServeFailEvent gameEvent) { AddPointStats(gameEvent); if (gameEvent.Serve == ServeFailKind.Error) { if (!CurrentState.SecondServe) { CurrentState.SecondServe = true; } else { var player = CurrentState.PlayerServes; if (player == Player.First) { player = Player.Second; } else { player = Player.First; } AddPoint(player); } } }
private void AddPointStats(ServeFailEvent gameEvent) { var(playerServes, playerReceiving) = CurrentState.PlayerServes == Player.First ? (PlayersStats.FirstPlayer, PlayersStats.SecondPlayer) : (PlayersStats.SecondPlayer, PlayersStats.FirstPlayer); if (gameEvent.Serve == ServeFailKind.Error) { if (!CurrentState.SecondServe) { playerServes.FirstServe++; } else { playerServes.SecondServe++; playerServes.DoubleFaults++; playerReceiving.TotalPoints++; } } }