Skip to content
Snippets Groups Projects
Commit 554e6a80 authored by LATIOUI's avatar LATIOUI
Browse files

Implementation of Road.class and refactoring MotorizedFireFighter.class

parent 342cb9d8
Branches
No related tags found
No related merge requests found
Pipeline #25023 passed
Showing
with 15 additions and 8 deletions
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -17,11 +17,12 @@ public class SimulatorApplication extends javafx.application.Application { ...@@ -17,11 +17,12 @@ public class SimulatorApplication extends javafx.application.Application {
private static final int COLUMN_COUNT = 20; private static final int COLUMN_COUNT = 20;
private static final int SQUARE_WIDTH = 30; private static final int SQUARE_WIDTH = 30;
private static final int SQUARE_HEIGHT = 30; private static final int SQUARE_HEIGHT = 30;
public static final int INITIAL_FIRE_COUNT = 5; public static final int INITIAL_FIRE_COUNT = 8;
public static final int INITIAL_FIREFIGHTER_COUNT = 3; public static final int INITIAL_FIREFIGHTER_COUNT = 3;
public static final int INITIAL_CLOUD_COUNT = 15; public static final int INITIAL_CLOUD_COUNT = 15;
public static final int INITIAL_MOTORIZEDFIREFIGHTER_COUNT = 2; public static final int INITIAL_MOTORIZEDFIREFIGHTER_COUNT = 2;
public static final int INITIAL_MOUNTAIN_COUNT = 15; public static final int INITIAL_MOUNTAIN_COUNT = 15;
public static final int INITIAL_ROAD_COUNT = 10;
private Stage primaryStage; private Stage primaryStage;
private Parent view; private Parent view;
...@@ -47,7 +48,7 @@ public class SimulatorApplication extends javafx.application.Application { ...@@ -47,7 +48,7 @@ public class SimulatorApplication extends javafx.application.Application {
view = loader.load(); view = loader.load();
Controller controller = loader.getController(); Controller controller = loader.getController();
controller.initialize(SQUARE_WIDTH, SQUARE_HEIGHT, COLUMN_COUNT, ROW_COUNT, controller.initialize(SQUARE_WIDTH, SQUARE_HEIGHT, COLUMN_COUNT, ROW_COUNT,
INITIAL_FIRE_COUNT, INITIAL_FIREFIGHTER_COUNT, INITIAL_CLOUD_COUNT,INITIAL_MOTORIZEDFIREFIGHTER_COUNT,INITIAL_MOUNTAIN_COUNT); INITIAL_FIRE_COUNT, INITIAL_FIREFIGHTER_COUNT, INITIAL_CLOUD_COUNT,INITIAL_MOTORIZEDFIREFIGHTER_COUNT,INITIAL_MOUNTAIN_COUNT,INITIAL_ROAD_COUNT);
} }
private void showScene() { private void showScene() {
......
...@@ -24,7 +24,7 @@ import static java.util.Objects.requireNonNull; ...@@ -24,7 +24,7 @@ import static java.util.Objects.requireNonNull;
public class Controller { public class Controller {
public static final int PERIOD_IN_MILLISECONDS = 50; public static final int PERIOD_IN_MILLISECONDS = 300;
@FXML @FXML
public Button restartButton; public Button restartButton;
@FXML @FXML
...@@ -111,10 +111,11 @@ public class Controller { ...@@ -111,10 +111,11 @@ public class Controller {
repaintGrid(); repaintGrid();
} }
public void initialize(int squareWidth, int squareHeight, int columnCount, public void initialize(int squareWidth, int squareHeight, int columnCount, int rowCount, int initialFireCount,
int rowCount, int initialFireCount, int initialFirefighterCount,int initialCloudCount,int initialMotorizedFireFighterCount,int initialMountainCount) { int initialFirefighterCount,int initialCloudCount,
int initialMotorizedFireFighterCount,int initialMountainCount,int initialRoadCount ) {
grid.setDimensions(columnCount, rowCount, squareWidth, squareHeight); grid.setDimensions(columnCount, rowCount, squareWidth, squareHeight);
board = new GameBoard(rowCount,columnCount,initialFireCount,initialFirefighterCount,initialCloudCount,initialMotorizedFireFighterCount,initialMountainCount); board = new GameBoard(rowCount,columnCount,initialFireCount,initialFirefighterCount,initialCloudCount,initialMotorizedFireFighterCount,initialMountainCount,initialRoadCount);
board.initializeElements(); board.initializeElements();
repaintGrid(); repaintGrid();
} }
......
...@@ -36,9 +36,13 @@ public class ConcreteGameBuilder implements GameBuilder{ ...@@ -36,9 +36,13 @@ public class ConcreteGameBuilder implements GameBuilder{
this.mountains=mountains; this.mountains=mountains;
return this; return this;
} }
public GameBuilder setRoad(int roads) {
this.roads=roads;
return this;
}
@Override @Override
public GameManage build() { public GameManage build() {
return new GameManage(fire,firefighter,clouds,motorizedFireFighters,roads,mountains); return new GameManage(fire,firefighter,clouds,motorizedFireFighters,mountains,roads);
} }
} }
\ No newline at end of file
package model.Builder; package model.Builder;
public class FireFirefightersBuilder { public class FireFirefightersBuilder {
public void Build(int fires, int firefighters , int clouds , int motorizedFireFighters ,int mountains) { public void Build(int fires, int firefighters , int clouds , int motorizedFireFighters ,int mountains,int roads) {
ConcreteGameBuilder concreteGameBuilder; ConcreteGameBuilder concreteGameBuilder;
concreteGameBuilder =new ConcreteGameBuilder(); concreteGameBuilder =new ConcreteGameBuilder();
concreteGameBuilder.setFire(fires) concreteGameBuilder.setFire(fires)
...@@ -9,6 +9,7 @@ public class FireFirefightersBuilder { ...@@ -9,6 +9,7 @@ public class FireFirefightersBuilder {
.setCloud(clouds) .setCloud(clouds)
.setMotorizedFireFighter(motorizedFireFighters) .setMotorizedFireFighter(motorizedFireFighters)
.setMountain(mountains) .setMountain(mountains)
.setRoad(roads)
.build(); .build();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment