mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Lager felt for winningPlayerName og setter og getter til den
Co-Authored-By: torlunjen <torlunjen@users.noreply.github.com>
This commit is contained in:
parent
48afdfd9f9
commit
ff2f8a849e
@ -30,11 +30,21 @@ public class RoboRallyGame implements IDrawableGame {
|
||||
private final boolean host;
|
||||
private Deck<ProgrammingCard> mainDeck;
|
||||
private GameState gameState = GameState.INITIAL_SETUP;
|
||||
private String winningPlayerName;
|
||||
|
||||
public String getWinningPlayerName() {
|
||||
return winningPlayerName;
|
||||
}
|
||||
|
||||
public void setWinningPlayerName(String winningPlayerName) {
|
||||
this.winningPlayerName = winningPlayerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the gameState of the game
|
||||
* @return the gameState of the game
|
||||
*/
|
||||
@Override
|
||||
public GameState getGameState(){
|
||||
return gameState;
|
||||
}
|
||||
@ -43,6 +53,7 @@ public class RoboRallyGame implements IDrawableGame {
|
||||
* Sets the gameState of the game
|
||||
* @param gameState the gameState
|
||||
*/
|
||||
@Override
|
||||
public void setGameState(GameState gameState) {
|
||||
this.gameState = gameState;
|
||||
}
|
||||
@ -499,14 +510,13 @@ public class RoboRallyGame implements IDrawableGame {
|
||||
gameBoard.updateFlagOnRobot(robotID, flag.getElement().getTileType());
|
||||
robot.setHasTouchedFlagThisTurn(true);
|
||||
if (victoryCheck(robot.getLastFlagVisited(), listOfFlags.size())) {
|
||||
Player winningPlayer;
|
||||
for (Player player : playerList) {
|
||||
if (player.getRobotID() != robotID) {
|
||||
continue;
|
||||
}
|
||||
winningPlayer = player;
|
||||
setWinningPlayerName(player.getName());
|
||||
setGameState(GameState.GAME_IS_WON);
|
||||
}
|
||||
//TODO: Make win screen announcing the winning player
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user