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