From a276a9e6e143de65ed9f832cb69d2e82b3fc185d Mon Sep 17 00:00:00 2001 From: ericnerdo Date: Sun, 24 Apr 2016 22:27:30 +0200 Subject: [PATCH] Field - finished --- cicaprojekt/Field.java | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/cicaprojekt/Field.java b/cicaprojekt/Field.java index e10e5b4..a9c38f6 100644 --- a/cicaprojekt/Field.java +++ b/cicaprojekt/Field.java @@ -3,40 +3,32 @@ package cicaprojekt; import java.util.HashMap; import java.util.Map; -public class Field extends Tile +public class Field extends cicaprojekt.Tile { - public static Map testAdjacentTile = new HashMap(); - public static Field testField = new Field(); - private static boolean testAdjTileSet = false; private static int recursionLimit = 0; public Field() { - setItemOnTile(new Box()); - adjacentTile = testAdjacentTile; - setTestAdjacentTile(); + super(); } - private void setTestAdjacentTile() { - if(!testAdjTileSet) { - testAdjacentTile.put(Direction.NORTH, Field.testField); - testAdjacentTile.put(Direction.EAST, Field.testField); - testAdjacentTile.put(Direction.SOUTH, Field.testField); - testAdjacentTile.put(Direction.WEST, Field.testField); - testAdjTileSet = true; - } - } @Override - public void spawnStargate(Stargate stargate, Direction direction) { + public void spawnStargate(cicaprojekt.Stargate stargate, Direction direction) { if (recursionLimit++ >= 10) this.adjacentTile.put(direction, new Wall()); adjacentTile.get(direction).spawnStargate(stargate, direction); } - public void onEntry() { + public void onEntry(PlayerBase playerBase) { + if(boxStack.size() > 0) + return; + playerBase.setCurrentTile(this); + if(zpmOnTile != null) + playerBase.pickItem(); } - public void onExit() { + public void onExit(PlayerBase playerBase) { + return; } }