implemented all functions of PlayerHandler

This commit is contained in:
Johannes Schmelz 2024-05-20 14:57:05 +02:00
parent f98d860b97
commit d58672a097
2 changed files with 9 additions and 4 deletions

View File

@ -19,11 +19,14 @@ public class PlayerHandler {
public PlayerHandler(MauMau game) { public PlayerHandler(MauMau game) {
this.game = game; this.game = game;
//Initialize all the States to be used
this.waitForNextTurnState = new WaitForNextTurnState(this); this.waitForNextTurnState = new WaitForNextTurnState(this);
this.waitForMauState = new WaitForMauState(this); this.waitForMauState = new WaitForMauState(this);
this.waitForMauMauState = new WaitForMauMauState(this); this.waitForMauMauState = new WaitForMauMauState(this);
this.finishedState = new FinishedState(); this.finishedState = new FinishedState();
//set waitingForNextTurnState as default
this.currentState = waitForNextTurnState; this.currentState = waitForNextTurnState;
} }
@ -48,15 +51,17 @@ public class PlayerHandler {
} }
public void addPlayer(Player player) { public void addPlayer(Player player) {
// Add player logic players.addLast(player);
} }
public void localNextTurn(int n) { 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) { public void finishPlayer(Player p) {
// Finish player logic ranking.addLast(players.removeFirst());
} }
public Player getCurrentPlayer() { public Player getCurrentPlayer() {
@ -92,6 +97,6 @@ public class PlayerHandler {
} }
public void finishGame() { public void finishGame() {
// Finish game logic finishPlayer(players.getFirst());
} }
} }