Updated 'TurnState' class.
Updated the 'TurnState' class by adding the 'player' attribute and its getter method to it.
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
			
		||||
package pp.mdga.server.automaton.game;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.game.Player;
 | 
			
		||||
import pp.mdga.server.ServerGameLogic;
 | 
			
		||||
import pp.mdga.server.automaton.GameState;
 | 
			
		||||
import pp.mdga.server.automaton.game.turn.*;
 | 
			
		||||
@@ -22,6 +23,7 @@ public class TurnState extends GameAutomatonState {
 | 
			
		||||
    private final RollDiceState rollDiceState;
 | 
			
		||||
    private final ChoosePieceState choosePieceState;
 | 
			
		||||
    private final MovePieceState movePieceState;
 | 
			
		||||
    private Player player;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a server state of the specified game logic.
 | 
			
		||||
@@ -42,6 +44,7 @@ public TurnState(GameState gameAutomaton, ServerGameLogic logic) {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        LOGGER.log(System.Logger.Level.DEBUG, "Entered TurnState state.");
 | 
			
		||||
        this.player = this.logic.getGame().getPlayerById(this.logic.getGame().getActivePlayerId());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -103,6 +106,15 @@ public MovePieceState getMovePieceState() {
 | 
			
		||||
        return this.movePieceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used to return player attribute of TurnState class.
 | 
			
		||||
     *
 | 
			
		||||
     * @return player as a Player object.
 | 
			
		||||
     */
 | 
			
		||||
    public Player getPlayer() {
 | 
			
		||||
        return this.player;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be used to set currentState attribute of TurnState class to the given state parameter.
 | 
			
		||||
     * In Addition, the currentState will be exited, changed and entered.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user