cicaprojekt/cicaprojekt/Player.java

45 lines
1.1 KiB
Java

package cicaprojekt;
import java.util.ArrayList;
import java.util.List;
public class Player extends PlayerBase {
private List<ZPM> zpmContainer;
private Box boxLifted;
public Player(String name, Tile startTile, Direction startDirection) {
super(name, startTile, startDirection);
zpmContainer = new ArrayList<>();
}
public boolean hasBox() {
return (boxLifted != null);
}
public void boxLift() {
boxLifted = (Box) currentTile.getAdjacentTile(facingDirection).getABox();
}
public void boxDrop() {
Tile target = currentTile.getAdjacentTile(facingDirection);
if(target.isSteppable()) {
target.putABox(boxLifted);
boxLifted = null;
}
}
@Override
public void pickZPM(Tile tile) {
zpmContainer.add(tile.getZPMFromTile());
}
public void shootStargate(Stargate stargate) {
this.currentTile.getAdjacentTile(facingDirection).spawnStargate(stargate, facingDirection);
}
public int getZPMCount(){
return zpmContainer.size();
}
}