From 97294f26b805f32b034906b52f5386559227fe6b Mon Sep 17 00:00:00 2001 From: MatthewFoster02 Date: Thu, 10 Mar 2022 12:45:24 +0100 Subject: [PATCH] Added boundaries --- src/main/java/app/model/Map.java | 4 ++++ src/main/java/app/model/boundary/BoundaryFactory.java | 2 +- src/main/java/app/model/furniture/FurnitureType.java | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/app/model/Map.java b/src/main/java/app/model/Map.java index 2be43258..a4250f58 100644 --- a/src/main/java/app/model/Map.java +++ b/src/main/java/app/model/Map.java @@ -11,6 +11,7 @@ import app.model.boundary.Boundary; import app.model.furniture.Furniture; import app.model.furniture.FurnitureFactory; +import app.model.furniture.FurnitureType; import app.view.simulation.Info; import java.util.ArrayList; import javafx.geometry.Rectangle2D; @@ -36,6 +37,9 @@ public Map(Settings settings) /* Make furniture */ furniture = new ArrayList<>(); + Rectangle2D rect = new Rectangle2D(0, 0, settings.getWidth(), settings.getHeight()); + SettingsObject border = new SettingsObject(rect, FurnitureType.BORDER); + addFurniture(border); settings.getFurniture().forEach(e -> addFurniture(e)); /* Make sound furniture */ diff --git a/src/main/java/app/model/boundary/BoundaryFactory.java b/src/main/java/app/model/boundary/BoundaryFactory.java index 1b5d7453..c29aa3ef 100644 --- a/src/main/java/app/model/boundary/BoundaryFactory.java +++ b/src/main/java/app/model/boundary/BoundaryFactory.java @@ -24,7 +24,7 @@ private static Boundary create(FurnitureType f, Vector a, Vector b, Vector telep { switch (f) { - case WALL, TOWER -> { return new VisibleBoundary(a, b);} + case WALL, TOWER, BORDER -> { return new VisibleBoundary(a, b);} case GLASS -> { return new TransparentBoundary(a, b);} case SHADE, GUARD_SPAWN, INTRUDER_SPAWN, TARGET -> { return new BoundaryImp(a, b);} case PORTAL -> {return new PortalBoundary(a, b, teleport);} diff --git a/src/main/java/app/model/furniture/FurnitureType.java b/src/main/java/app/model/furniture/FurnitureType.java index 826b4886..003ef379 100644 --- a/src/main/java/app/model/furniture/FurnitureType.java +++ b/src/main/java/app/model/furniture/FurnitureType.java @@ -9,7 +9,8 @@ public enum FurnitureType PORTAL("teleport"), GUARD_SPAWN("spawnAreaGuards"), INTRUDER_SPAWN("spawnAreaIntruders"), - TARGET("targetArea"); + TARGET("targetArea"), + BORDER("border"); public final String label;