private void DoPlayingCards() { if (GameState != RoboGameState.ChoosingCards || !IsChoosingCardsFinished) { return; } GameState = RoboGameState.PlayingCards; for (int i = 0; i < 5; i++) { foreach (RoboPlayerPlugin elem in ActivePlayers.OrderBy(elem => elem.Player.TimeEndRound.Ticks)) { if (elem.Player.PlayerState != RoboPlayerState.Decided) { continue; } RoboUtils.PlayCardCore(GetBoard(Board, elem.Player, ActivePlayers.Select(plugin => plugin.Player)), elem.Player.ChosenCards[i], elem.Player.Position); elem.Player.TotalPlayedCards++; if (Board.GetField(elem.Player.Position).IsDestination) { elem.Player.PlayerState = RoboPlayerState.Finished; } else if (elem.Player.Position.IsDead) { elem.Player.PlayerState = RoboPlayerState.Dead; } else if (i == 4) { elem.Player.PlayerState = RoboPlayerState.Ready; } } } GameState = RoboGameState.Ready; Action starter = StartRound; starter.BeginInvoke(null, starter); }