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
No related branches found
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 {
private static final int COLUMN_COUNT = 20;
private static final int SQUARE_WIDTH = 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_CLOUD_COUNT = 15;
public static final int INITIAL_MOTORIZEDFIREFIGHTER_COUNT = 2;
public static final int INITIAL_MOUNTAIN_COUNT = 15;
public static final int INITIAL_ROAD_COUNT = 10;
private Stage primaryStage;
private Parent view;
......@@ -47,7 +48,7 @@ public class SimulatorApplication extends javafx.application.Application {
view = loader.load();
Controller controller = loader.getController();
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() {
......
......@@ -24,7 +24,7 @@ import static java.util.Objects.requireNonNull;
public class Controller {
public static final int PERIOD_IN_MILLISECONDS = 50;
public static final int PERIOD_IN_MILLISECONDS = 300;
@FXML
public Button restartButton;
@FXML
......@@ -111,10 +111,11 @@ public class Controller {
repaintGrid();
}
public void initialize(int squareWidth, int squareHeight, int columnCount,
int rowCount, int initialFireCount, int initialFirefighterCount,int initialCloudCount,int initialMotorizedFireFighterCount,int initialMountainCount) {
public void initialize(int squareWidth, int squareHeight, int columnCount, int rowCount, int initialFireCount,
int initialFirefighterCount,int initialCloudCount,
int initialMotorizedFireFighterCount,int initialMountainCount,int initialRoadCount ) {
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();
repaintGrid();
}
......
......@@ -36,9 +36,13 @@ public class ConcreteGameBuilder implements GameBuilder{
this.mountains=mountains;
return this;
}
public GameBuilder setRoad(int roads) {
this.roads=roads;
return this;
}
@Override
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;
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 =new ConcreteGameBuilder();
concreteGameBuilder.setFire(fires)
......@@ -9,6 +9,7 @@ public class FireFirefightersBuilder {
.setCloud(clouds)
.setMotorizedFireFighter(motorizedFireFighters)
.setMountain(mountains)
.setRoad(roads)
.build();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment