Пример #1
0
 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;
 }
Пример #2
0
 private bool IsWinner(GamePlayer player)
 {
     return (player.Score + 1) >= firstTo;
 }
Пример #3
0
 public void Handle(GameStartedEvent @event)
 {
     state = GameState.Started;
     playerTwo = new GamePlayer(@event.PlayerTwoId);
 }
Пример #4
0
 private void GameWonBy(GamePlayer player, MakeChoiceCommand command, List<IEvent> events)
 {
     events.Add(new GameWonEvent(command.EntityId, player.Email));
 }
Пример #5
0
 public void Handle(GameCreatedEvent @event)
 {
     id = @event.GameId;
     title = @event.Title;
     playerOne = new GamePlayer(@event.PlayerId);
     firstTo = @event.FirstTo;
 }