developmaunt #3

Merged
DTieman merged 5 commits from developmaunt into mauster 2024-05-25 21:43:51 +00:00
3 changed files with 14 additions and 13 deletions
Showing only changes of commit f5c2b937b0 - Show all commits

View File

@@ -102,7 +102,7 @@ public class Game : RoomType
// Change the turn if the player that left was the current player
if (player == _turnManager.CurrentPlayer)
{
_turnManager.ChangeTurn();
_turnManager.ChangeTurnTo();
}
// Remove the player from the game
@@ -144,7 +144,7 @@ public class Game : RoomType
_deck.CurrentCard = new Card(cardType, CardValue.JACK);
// Change the turns
_turnManager.ChangeTurn(nextPlayer);
_turnManager.ChangeTurnTo(nextPlayer);
// Broadcast new game state
SendGameState();
@@ -172,7 +172,7 @@ public class Game : RoomType
// Change the player if the drawn card cannot be played
if (!drawnCard.CanBePlayedOn(_deck.CurrentCard))
{
_turnManager.ChangeTurn();
_turnManager.ChangeTurnTo();
}
// Broadcast new game state
@@ -258,20 +258,20 @@ public class Game : RoomType
case CardValue.TWO:
{
_turnManager.GetNextPlayer().GiveCards(_deck.DrawCards(2));
_turnManager.ChangeTurn(_turnManager.GetNextPlayer(2));
_turnManager.ChangeTurnTo(_turnManager.GetNextPlayer(2));
break;
}
case CardValue.SEVEN:
case CardValue.KING:
break;
case CardValue.EIGHT:
_turnManager.ChangeTurn(_turnManager.GetNextPlayer(2));
_turnManager.ChangeTurnTo(_turnManager.GetNextPlayer(2));
break;
case CardValue.ACE:
if (_turnManager.Players.Count > 2)
{
_turnManager.ChangeDirection();
_turnManager.ChangeTurn();
_turnManager.ChangeTurnTo();
}
break;
case CardValue.JACK:
@@ -285,7 +285,7 @@ public class Game : RoomType
case CardValue.TEN:
case CardValue.QUEEN:
default:
_turnManager.ChangeTurn();
_turnManager.ChangeTurnTo();
break;
}
}

View File

@@ -39,14 +39,14 @@ public class TurnManager
* Change the turn to another player.
* If no player is given, the next player in the current direction is chosen.
* </summary>
* <param name="nextPlayer">The player to change the turn to. Defaults to the next player in the current direction.</param>
* <param name="playerayer">The player to change the turn to. Defaults to the next player in the current direction.</param>
*/
public void ChangeTurn(Player? nextPlayer = null)
public void ChangeTurnTo(Player? player = null, PlayerState nextPlayerState = PlayerState.TURN)
{
var player = nextPlayer ?? GetNextPlayer();
var nextPlayer = player ?? GetNextPlayer();
CurrentPlayer.State = PlayerState.WAIT;
player.State = PlayerState.TURN;
CurrentPlayer = player;
nextPlayer.State = nextPlayerState;
CurrentPlayer = nextPlayer;
}
/**

View File

@@ -4,5 +4,6 @@ public enum PlayerState
{
TURN,
CHOOSE,
WAIT
WAIT,
POST_DRAW
}