Package it.polimi.ingsw.model
Class TurnManager
java.lang.Object
it.polimi.ingsw.model.TurnManager
- All Implemented Interfaces:
IGameState
public class TurnManager extends java.lang.Object implements IGameState
Represent the current phase of the game and manages the players turn
-
Constructor Summary
Constructors Constructor Description TurnManager(Game game, java.util.List<java.lang.String> usernames) -
Method Summary
Modifier and Type Method Description PhaseTypegetCurrentPhase()java.lang.StringgetCurrentPlayer()GamegetGame()MessagehandleAction(Action action)Perform an action and change current turn statejava.util.List<java.lang.String>startGame()Start gameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
TurnManager
public TurnManager(Game game, java.util.List<java.lang.String> usernames) throws java.io.IOException, MaximumNumberOfPlayersException- Throws:
java.io.IOExceptionMaximumNumberOfPlayersException
-
-
Method Details
-
startGame
public java.util.List<java.lang.String> startGame()Start game- Returns:
- a list of all the player in order
-
handleAction
Perform an action and change current turn state- Parameters:
action- the action to perform- Returns:
- a message containing the next turn state or an error
- Throws:
NoConnectedPlayerException- if the last player disconnected
-
getCurrentPlayer
public java.lang.String getCurrentPlayer()- Specified by:
getCurrentPlayerin interfaceIGameState
-
getCurrentPhase
- Specified by:
getCurrentPhasein interfaceIGameState
-
getGame
- Specified by:
getGamein interfaceIGameState
-