Tile-attributes changed

Tile.itemOnTile no longer exists, it was replaced by boxStack and zpmOnTile. Getter-Setter methods were added.
This commit is contained in:
ericnerdo 2016-04-24 21:19:35 +02:00
parent 4f81192938
commit 0a4b00aad3

View File

@ -2,10 +2,12 @@ package cicaprojekt;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Stack;
public abstract class Tile { public abstract class Tile {
protected Map<Direction, Tile> adjacentTile; protected Map<Direction, Tile> adjacentTile;
private Pickable itemOnTile; protected ZPM zpmOnTile;
protected Stack<Box> boxStack;
public Tile(){ public Tile(){
@ -15,7 +17,7 @@ public abstract class Tile {
adjacentTile.put(Direction.EAST, Field.testField); adjacentTile.put(Direction.EAST, Field.testField);
adjacentTile.put(Direction.SOUTH, Field.testField); adjacentTile.put(Direction.SOUTH, Field.testField);
adjacentTile.put(Direction.WEST, Field.testField); adjacentTile.put(Direction.WEST, Field.testField);
itemOnTile = new Box(); zpmOnTile = new ZPM();
} }
public Tile getAdjacentTile(Direction direction) { public Tile getAdjacentTile(Direction direction) {
@ -32,13 +34,17 @@ public abstract class Tile {
public abstract void onExit(PlayerBase playerBase); public abstract void onExit(PlayerBase playerBase);
public Pickable removeItemFromTile() { public ZPM getZPMFromTile() {
Pickable item = itemOnTile; ZPM zpm = zpmOnTile;
itemOnTile = null; zpmOnTile = null;
return item; return zpm;
} }
public void setItemOnTile(Pickable item) { public void putABox(Box box) {
itemOnTile = item; boxStack.push(box);
}
public Box getABox(){
return boxStack.pop();
} }
} }