PacManDuel.Models.PlayerPool.GetNextPlayer C# (CSharp) Method

GetNextPlayer() public method

public GetNextPlayer ( ) : Player
return Player
        public Player GetNextPlayer()
        {
            _currentPlayerIndex++;
            if (_currentPlayerIndex > _players.Count - 1)
                _currentPlayerIndex = 0;
            return _players[_currentPlayerIndex];
        }

Usage Example

 public static Player DetermineWinner(PlayerPool playerPool, Enums.GameOutcome gameOutcome)
 {
     if (playerPool.GetPlayers()[0].GetScore() != playerPool.GetPlayers()[1].GetScore())
         return playerPool.GetPlayers().OrderByDescending(x => x.GetScore()).First();
     if (gameOutcome == Enums.GameOutcome.NoScoringMaxed)
         return playerPool.GetNextPlayer();
     return null;
 }
All Usage Examples Of PacManDuel.Models.PlayerPool::GetNextPlayer