On death a menu will pop up telling the user he is dead. #story[1292]

main
zwu18 8 years ago
parent 1b8fa59f0e
commit 416eb1e6bf

@ -103,6 +103,8 @@ public class RaceViewController extends Controller {
private @FXML AnchorPane lineChartWrapper;
private @FXML GridPane playerHealthContainer;
private @FXML ImageView imageView;
private @FXML AnchorPane deathTransPane;
private @FXML StackPane deathPane;
/**
* Displays a specified race.
@ -117,6 +119,8 @@ public class RaceViewController extends Controller {
this.controllerClient = controllerClient;
this.isHost = isHost;
keyFactory.load();
deathPane.setDisable(false);
deathPane.setVisible(false);
tutorialCheck();
initKeypressHandler();
initialiseRaceVisuals();
@ -694,6 +698,16 @@ public class RaceViewController extends Controller {
if (raceState.getRaceStatusEnum() == RaceStatusEnum.FINISHED) {
stop(); // stop the timer
} else {
try {
if(raceState.getBoat(raceState.getPlayerBoatID()).getHealth()<=0){
if(!deathPane.isDisable()) {
deathPane.setVisible(true);
}
}
} catch (BoatNotFoundException e) {
e.printStackTrace();
}
for(VisualiserBoat boat : raceState.getBoats()){
for (HealthEffect fp : healthEffectList){
@ -883,4 +897,9 @@ public class RaceViewController extends Controller {
mapToggle = !mapToggle;
}
public void deathOKPressed(){
deathPane.setDisable(true);
deathPane.setVisible(false);
}
}

@ -187,6 +187,29 @@
</children>
</AnchorPane>
<ImageView fx:id="imageView" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
<StackPane fx:id="deathPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<AnchorPane mouseTransparent="true" opacity="0.31" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: grey;" />
<Label alignment="CENTER" text="You have died..." StackPane.alignment="TOP_CENTER">
<font>
<Font size="34.0" />
</font>
<StackPane.margin>
<Insets top="100.0" />
</StackPane.margin>
</Label>
<Label alignment="CENTER" text="But you can still watch the race!" StackPane.alignment="TOP_CENTER">
<StackPane.margin>
<Insets top="165.0" />
</StackPane.margin>
</Label>
<Button alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#deathOKPressed" prefHeight="25.0" prefWidth="52.0" text="OK" StackPane.alignment="TOP_CENTER">
<StackPane.margin>
<Insets top="200.0" />
</StackPane.margin>
</Button>
</children>
</StackPane>
</children>
</AnchorPane>
<AnchorPane fx:id="infoWrapper" focusTraversable="true" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" visible="false">

Loading…
Cancel
Save