implemented PlayerBase.pickZPM() (former pickItem()) callback method

This commit is contained in:
Kjistóf 2016-04-24 22:48:17 +02:00
parent 69a2384160
commit d0d656452c
3 changed files with 15 additions and 6 deletions

View File

@ -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) {

View File

@ -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 */
}
@ -21,6 +23,12 @@ public class Player extends PlayerBase{
boxLifted = null;
}
@Override
public void pickZPM(Tile tile)
{
zpmContainer.add(tile.getZPMFromTile());
}
public void shootStargate(Stargate stargate) {
this.currentTile.getAdjacentTile(facingDirection).spawnStargate(stargate, facingDirection);
}

View File

@ -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: