53 lines
1.9 KiB
Java
53 lines
1.9 KiB
Java
package cicaprojekt;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
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;
|
|
|
|
public Field() {
|
|
setItemOnTile(new Box());
|
|
|
|
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
|
|
public void spawnStargate(cicaprojekt.Stargate stargate, Direction direction) {
|
|
Menu.addTab();
|
|
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Field.spawnStargate(Stargate stargate, Direction direction)");
|
|
adjacentTile.get(direction).spawnStargate(stargate, direction);
|
|
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Field.spawnStargate(Stargate stargate, Direction direction)");
|
|
Menu.removeTab();
|
|
}
|
|
|
|
public void onEntry() {
|
|
Menu.addTab();
|
|
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Field.onEntry()");
|
|
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Field.onEntry()");
|
|
Menu.removeTab();
|
|
}
|
|
|
|
public void onExit() {
|
|
Menu.addTab();
|
|
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Field.onExit()");
|
|
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Field.onExit()");
|
|
Menu.removeTab();
|
|
}
|
|
|
|
}
|