reformatted code
This commit is contained in:
@ -1,69 +1,70 @@
|
||||
package cicaprojekt;
|
||||
|
||||
public class PlayerBase implements Destroyable{
|
||||
protected Game game;
|
||||
protected Tile currentTile;
|
||||
protected Direction facingDirection;
|
||||
public class PlayerBase implements Destroyable {
|
||||
protected Game game;
|
||||
protected Tile currentTile;
|
||||
protected Direction facingDirection;
|
||||
|
||||
|
||||
public void destroy() {}
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
public Tile getCurrentTile() {
|
||||
return currentTile;
|
||||
}
|
||||
public Tile getCurrentTile() {
|
||||
return currentTile;
|
||||
}
|
||||
|
||||
public void setCurrentTile(Tile newCurrentTile) {
|
||||
currentTile = newCurrentTile;
|
||||
}
|
||||
public void setCurrentTile(Tile newCurrentTile) {
|
||||
currentTile = newCurrentTile;
|
||||
}
|
||||
|
||||
public void move(Direction direction) {
|
||||
this.setFacingDirection(direction);
|
||||
Tile tile = this.getCurrentTile().getAdjacentTile(direction);
|
||||
tile.onEntry(this);
|
||||
setCurrentTile(tile);
|
||||
}
|
||||
public void move(Direction direction) {
|
||||
this.setFacingDirection(direction);
|
||||
Tile tile = this.getCurrentTile().getAdjacentTile(direction);
|
||||
tile.onEntry(this);
|
||||
setCurrentTile(tile);
|
||||
}
|
||||
|
||||
public void pickZPM(Tile tile) { /* PlayerBase does not collect ZPM modules */ }
|
||||
|
||||
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 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 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 Direction getFacingDirection() {
|
||||
return facingDirection;
|
||||
}
|
||||
public Direction getFacingDirection() {
|
||||
return facingDirection;
|
||||
}
|
||||
|
||||
public void setFacingDirection(Direction direction) {
|
||||
facingDirection = direction;
|
||||
}
|
||||
public void setFacingDirection(Direction direction) {
|
||||
facingDirection = direction;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user