implemented all functions of PlayerHandler
This commit is contained in:
parent
f98d860b97
commit
d58672a097
Binary file not shown.
@ -19,11 +19,14 @@ public class PlayerHandler {
|
||||
|
||||
public PlayerHandler(MauMau game) {
|
||||
this.game = game;
|
||||
|
||||
//Initialize all the States to be used
|
||||
this.waitForNextTurnState = new WaitForNextTurnState(this);
|
||||
this.waitForMauState = new WaitForMauState(this);
|
||||
this.waitForMauMauState = new WaitForMauMauState(this);
|
||||
this.finishedState = new FinishedState();
|
||||
|
||||
//set waitingForNextTurnState as default
|
||||
this.currentState = waitForNextTurnState;
|
||||
}
|
||||
|
||||
@ -48,15 +51,17 @@ public class PlayerHandler {
|
||||
}
|
||||
|
||||
public void addPlayer(Player player) {
|
||||
// Add player logic
|
||||
players.addLast(player);
|
||||
}
|
||||
|
||||
public void localNextTurn(int n) {
|
||||
// Local next turn logic
|
||||
for(int i = 0; i < n; i++){
|
||||
players.addLast(players.getFirst());
|
||||
}
|
||||
}
|
||||
|
||||
public void finishPlayer(Player p) {
|
||||
// Finish player logic
|
||||
ranking.addLast(players.removeFirst());
|
||||
}
|
||||
|
||||
public Player getCurrentPlayer() {
|
||||
@ -92,6 +97,6 @@ public class PlayerHandler {
|
||||
}
|
||||
|
||||
public void finishGame() {
|
||||
// Finish game logic
|
||||
finishPlayer(players.getFirst());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user