cicaprojekt/cicaprojekt/ONeill.java
2016-04-01 17:48:00 +02:00

122 lines
4.4 KiB
Java

package cicaprojekt;
import java.util.List;
public class ONeill implements Destroyable{
private Game game;
private List<ZPM> zpmContainer;
private cicaprojekt.Tile currentTile;
private Direction facingDirection;
private Box boxLifted;
public void destroy() {
Menu.addTab();
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.destroy()");
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.destroy()");
Menu.removeTab();
}
public cicaprojekt.Tile getCurrentTile() {
Menu.addTab();
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.getCurrentTile()");
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.getCurrentTile()");
Menu.removeTab();
return currentTile;
}
public void setCurrentTile(cicaprojekt.Tile newCurrentTile) {
Menu.addTab();
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.setCurrentTile()");
currentTile = newCurrentTile;
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.setCurrentTile()");
Menu.removeTab();
}
public void move(Direction direction) {
Menu.addTab();
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Oneill.move(" + direction.name() + ")");
this.setFacingDirection(direction);
Tile tile = this.getCurrentTile().getAdjacentTile(direction);
tile.onEntry();
setCurrentTile(tile);
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Oneill.move()");
Menu.removeTab();
}
public void boxLift() {
Menu.addTab();
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.boxLift()");
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.boxLift()");
Menu.removeTab();
boxLifted = (Box) currentTile.getAdjacentTile(facingDirection).removeItemFromTile();
}
public void rotateLeft() {
switch (facingDirection) {
case NORTH:
facingDirection = Direction.WEST;
break;
case WEST:
facingDirection = Direction.SOUTH;
break;
case SOUTH:
facingDirection = Direction.EAST;
break;
case EAST:
facingDirection = Direction.NORTH;
break;
}
}
public void rotateRight() {
switch (facingDirection) {
case NORTH:
facingDirection = Direction.EAST;
break;
case EAST:
facingDirection = Direction.SOUTH;
break;
case SOUTH:
facingDirection = Direction.WEST;
break;
case WEST:
facingDirection = Direction.NORTH;
break;
}
}
public void boxDrop() {
Menu.addTab();
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.boxDrop()");
currentTile.getAdjacentTile(facingDirection).setItemOnTile(boxLifted);
boxLifted = null;
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.boxDrop()");
Menu.removeTab();
}
public Direction getFacingDirection() {
Menu.addTab();
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.getFacingDirection()");
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.getFacingDirection()");
Menu.removeTab();
return facingDirection;
}
public void setFacingDirection(Direction direction) {
Menu.addTab();
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.setFacingDirection(" + direction.name() + ")");
facingDirection = direction;
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.setFacingDirection()");
Menu.removeTab();
}
public void shootStargate(Stargate stargate) {
Menu.addTab();
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.shootStargate(stargate)");
this.currentTile.getAdjacentTile(facingDirection).spawnStargate(stargate, facingDirection);
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "ONeill.shootStargate()");
Menu.removeTab();
}
}