mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-07-29 11:15:27 +02:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
Conflicts: src/main/java/inf112/fiasko/roborally/gamewrapper/ScreenManager.java src/main/java/inf112/fiasko/roborally/gamewrapper/screens/BoardActiveScreen.java src/main/java/inf112/fiasko/roborally/gamewrapper/screens/WinnerScreen.java src/test/java/inf112/fiasko/roborally/objects/RoboRallyGameTest.java
This commit is contained in:
@@ -65,6 +65,17 @@ public interface IDrawableGame {
|
||||
*/
|
||||
GameState getGameState();
|
||||
|
||||
/**
|
||||
* Sets the current state og the game
|
||||
*/
|
||||
void setGameState(GameState gameState);
|
||||
|
||||
/**
|
||||
* Gets the name of the player who won
|
||||
* @return A string of the player name
|
||||
*/
|
||||
String getWinningPlayerName();
|
||||
|
||||
|
||||
RoboRallyClient getClient();
|
||||
|
||||
|
@@ -36,6 +36,7 @@ public class RoboRallyGame implements IDrawableGame {
|
||||
private String nameOfPlayer;
|
||||
private RoboRallyClient client;
|
||||
private RoboRallyServer server;
|
||||
private String winningPlayerName;
|
||||
|
||||
|
||||
|
||||
@@ -47,14 +48,33 @@ public class RoboRallyGame implements IDrawableGame {
|
||||
this.nameOfPlayer = nameOfPlayer;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gameState of the game
|
||||
* @param gameState the gameState
|
||||
*/
|
||||
@Override
|
||||
public void setGameState(GameState gameState) {
|
||||
this.gameState = gameState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoboRallyClient getClient() {
|
||||
return client;
|
||||
@@ -71,14 +91,6 @@ public class RoboRallyGame implements IDrawableGame {
|
||||
this.server=server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gameState of the game
|
||||
* @param gameState the gameState
|
||||
*/
|
||||
public void setGameState(GameState gameState) {
|
||||
this.gameState = gameState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new robo rally game
|
||||
* @param debug Whether to start the game in debugging mode
|
||||
@@ -93,6 +105,7 @@ public class RoboRallyGame implements IDrawableGame {
|
||||
initializeGame(boardName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new robo rally game
|
||||
*/
|
||||
@@ -560,14 +573,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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user