initialize repo
This commit is contained in:
24
Lib/Civilization.Core/Game/TurnManager.cs
Normal file
24
Lib/Civilization.Core/Game/TurnManager.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Civilization.Core.Game;
|
||||
|
||||
public class TurnManager
|
||||
{
|
||||
private readonly List<Player> _players = [];
|
||||
private int _currentIndex = 0;
|
||||
|
||||
public int TurnNumber { get; private set; } = 1;
|
||||
public Player CurrentPlayer => _players[_currentIndex];
|
||||
|
||||
public TurnManager(IEnumerable<Player> players)
|
||||
{
|
||||
_players = players.ToList();
|
||||
}
|
||||
|
||||
public void AdvanceTurn()
|
||||
{
|
||||
_currentIndex++;
|
||||
if (_currentIndex < _players.Count) return;
|
||||
|
||||
_currentIndex = 0;
|
||||
TurnNumber++;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user