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