diff --git a/cicaprojekt/Dungeon.java b/cicaprojekt/Dungeon.java index fe9b061..2aacede 100644 --- a/cicaprojekt/Dungeon.java +++ b/cicaprojekt/Dungeon.java @@ -31,7 +31,7 @@ public class Dungeon { * S: Scale * X: Gap * R: Replicator */ - Map buildDungeon(File input) throws IOException + Map buildDungeon(File input, Display display) throws IOException { Tile defaultTile = new Field(); defaultTile.setX(-666); @@ -63,29 +63,35 @@ public class Dungeon { { case 'W': tile = new Wall(); + display.addVisual(new WallDrawer((Wall) tile)); break; case 'F': tile = new Field(); + display.addVisual(new FieldDrawer((Field) tile)); break; case 'Z': tile = new Field(); + display.addVisual(new FieldDrawer((Field) tile)); tile.setZPMOnTile(new ZPM()); break; case 'B': tile = new Field(); + display.addVisual(new FieldDrawer((Field) tile)); tile.putABox(new Box()); break; case 'O': tile = new Field(); + display.addVisual(new FieldDrawer((Field) tile)); oneilllocation = tile; break; case 'J': tile = new Field(); + display.addVisual(new FieldDrawer((Field) tile)); jaffalocation = tile; break; @@ -100,10 +106,12 @@ public class Dungeon { case 'X': tile = new Gap(); + display.addVisual(new GapDrawer((Gap) tile)); break; case 'R': tile = new Field(); + display.addVisual(new FieldDrawer((Field) tile)); replicatorlocation = tile; break; } @@ -125,10 +133,12 @@ public class Dungeon { int triggerweight = Integer.parseInt(scaledata[4]); Gate gate = new Gate(); + display.addVisual(new GateDrawer(gate)); gate.setY(gy); gate.setX(gx); Scale scale = new Scale(gate, triggerweight); + display.addVisual(new ScaleDrawer(scale)); scale.setY(sy); scale.setX(sx); diff --git a/cicaprojekt/Game.java b/cicaprojekt/Game.java index 566230b..2f82798 100644 --- a/cicaprojekt/Game.java +++ b/cicaprojekt/Game.java @@ -32,7 +32,7 @@ public class Game { public void startGame(File dungeonFile) throws IOException { Stargate.init(); - Map players = dungeon.buildDungeon(dungeonFile); + Map players = dungeon.buildDungeon(dungeonFile, display); oneill = new Player("O'Neill", players.get("oneill"), getRandomDirection()); jaffa = new Player("Jaffa", players.get("jaffa"), getRandomDirection()); replicator = new PlayerBase("Replicator", players.get("replicator"), getRandomDirection());