Field - finished

This commit is contained in:
ericnerdo 2016-04-24 22:27:30 +02:00
parent 924a5acc26
commit a276a9e6e1

View File

@ -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<Direction, Tile> testAdjacentTile = new HashMap<Direction, Tile>();
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;
}
}