private bool RoundWonBy(GamePlayer player, MakeChoiceCommand command, List<IEvent> events) { events.Add(new RoundWonEvent(command.EntityId, player.Email, round)); if (IsWinner(playerTwo)) { GameWonBy(playerTwo, command, events); return false; } return true; }
private bool IsWinner(GamePlayer player) { return (player.Score + 1) >= firstTo; }
public void Handle(GameStartedEvent @event) { state = GameState.Started; playerTwo = new GamePlayer(@event.PlayerTwoId); }
private void GameWonBy(GamePlayer player, MakeChoiceCommand command, List<IEvent> events) { events.Add(new GameWonEvent(command.EntityId, player.Email)); }
public void Handle(GameCreatedEvent @event) { id = @event.GameId; title = @event.Title; playerOne = new GamePlayer(@event.PlayerId); firstTo = @event.FirstTo; }