Field - finished
This commit is contained in:
parent
924a5acc26
commit
a276a9e6e1
@ -3,40 +3,32 @@ package cicaprojekt;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
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;
|
private static int recursionLimit = 0;
|
||||||
|
|
||||||
|
|
||||||
public Field() {
|
public Field() {
|
||||||
setItemOnTile(new Box());
|
super();
|
||||||
adjacentTile = testAdjacentTile;
|
|
||||||
setTestAdjacentTile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
@Override
|
||||||
public void spawnStargate(Stargate stargate, Direction direction) {
|
public void spawnStargate(cicaprojekt.Stargate stargate, Direction direction) {
|
||||||
if (recursionLimit++ >= 10)
|
if (recursionLimit++ >= 10)
|
||||||
this.adjacentTile.put(direction, new Wall());
|
this.adjacentTile.put(direction, new Wall());
|
||||||
adjacentTile.get(direction).spawnStargate(stargate, direction);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user