diff --git a/cicaprojekt/Field.java b/cicaprojekt/Field.java index a9c38f6..69161c9 100644 --- a/cicaprojekt/Field.java +++ b/cicaprojekt/Field.java @@ -25,7 +25,7 @@ public class Field extends cicaprojekt.Tile return; playerBase.setCurrentTile(this); if(zpmOnTile != null) - playerBase.pickItem(); + playerBase.pickZPM(this); } public void onExit(PlayerBase playerBase) { diff --git a/cicaprojekt/Player.java b/cicaprojekt/Player.java index 184f159..9c249f1 100644 --- a/cicaprojekt/Player.java +++ b/cicaprojekt/Player.java @@ -1,5 +1,6 @@ package cicaprojekt; +import java.util.ArrayList; import java.util.List; public class Player extends PlayerBase{ @@ -8,6 +9,7 @@ public class Player extends PlayerBase{ public Player(Tile startTile, Direction startDirection){ + zpmContainer = new ArrayList<>(); currentTile = startTile; facingDirection = startDirection; /* Be lehetne állítani egy defaultot is, nem tudom, mennyire kéne */ } @@ -20,8 +22,14 @@ public class Player extends PlayerBase{ currentTile.getAdjacentTile(facingDirection).putABox(boxLifted); boxLifted = null; } - - public void shootStargate(Stargate stargate) { + + @Override + public void pickZPM(Tile tile) + { + zpmContainer.add(tile.getZPMFromTile()); + } + + public void shootStargate(Stargate stargate) { this.currentTile.getAdjacentTile(facingDirection).spawnStargate(stargate, facingDirection); } } diff --git a/cicaprojekt/PlayerBase.java b/cicaprojekt/PlayerBase.java index e2c3825..29c2f5c 100644 --- a/cicaprojekt/PlayerBase.java +++ b/cicaprojekt/PlayerBase.java @@ -6,8 +6,7 @@ public class PlayerBase implements Destroyable{ protected Direction facingDirection; - public void destroy() { - } + public void destroy() {} public Tile getCurrentTile() { return currentTile; @@ -20,10 +19,12 @@ public class PlayerBase implements Destroyable{ public void move(Direction direction) { this.setFacingDirection(direction); Tile tile = this.getCurrentTile().getAdjacentTile(direction); - tile.onEntry(); + tile.onEntry(this); setCurrentTile(tile); } + public void pickZPM(Tile tile) { /* PlayerBase does not collect ZPM modules */ } + public void rotateLeft() { switch (facingDirection) { case NORTH: