Exemple #1
0
 /// <summary>
 /// Устанавливает следующего ходящего
 /// </summary>
 /// <param name="loser"></param>
 private void SetNextMover(GamePlayer loser = null)
 {
     if (CurrentMover == null)
     {
         CurrentMover = GamePlayers.First(p => p.Priority == GamePlayers.Min(pm => pm.Priority)).Player;
     }
     else if (loser == null || loser.Player.Id == CurrentMover.Id)
     {
         CurrentMover = GetNextMover().Player;
     }
 }
Exemple #2
0
        private GamePlayer GetNextMover()
        {
            var gamePlayer = GamePlayers.First(gp => gp.Player.Id == CurrentMover.Id);

            if (GamePlayers.Max(gp => gp.Priority) == gamePlayer.Priority)
            {
                return(GamePlayers.First(gp => gp.Priority == GamePlayers.Min(p => p.Priority)));
            }
            else
            {
                return(GamePlayers
                       .Where(gp => gp.Priority > gamePlayer.Priority)
                       .First(gp => gp.Priority == GamePlayers.Where(p => p.Priority > gamePlayer.Priority).Min(p => p.Priority)));
            }
        }