now "flying" Stargates destroy Replicators, and belonging bugfix

Game.playerBaseDestroyed() is not called everythime a PlayerBase is
destroyed.
This commit is contained in:
Kjistóf 2016-05-13 23:52:10 +02:00
parent 7d059701cc
commit 89a1da497f
9 changed files with 16 additions and 4 deletions

View File

@ -17,6 +17,7 @@ public class Field extends cicaprojekt.Tile {
}
public void onEntry(PlayerBase playerBase) {
super.onEntry(playerBase);
if (boxStack.size() > 0)
return;
playerBase.setCurrentTile(this);

View File

@ -12,7 +12,9 @@ public class Gap extends cicaprojekt.Tile {
}
public void onEntry(PlayerBase playerBase) {
super.onEntry(playerBase);
playerBase.destroy();
Game.instance.playerBaseDestroyed(playerBase);
}
public void onExit(PlayerBase playerBase) throws IllegalStateException {

View File

@ -13,6 +13,7 @@ public class Gate extends Tile {
}
public void onEntry(PlayerBase playerBase) {
super.onEntry(playerBase);
if (open) {
playerBase.setCurrentTile(this);
} else

View File

@ -20,7 +20,6 @@ public class PlayerBase implements Destroyable {
public void destroy() {
destroyed = true;
Game.instance.playerBaseDestroyed(this);
}
public Tile getCurrentTile() {

View File

@ -25,6 +25,7 @@ public class Scale extends Field {
@Override
public void onEntry(PlayerBase playerBase) {
super.onEntry(playerBase);
gateConnected.setOpen(true);
}

View File

@ -58,6 +58,7 @@ public class Stargate {
public boolean isSpawned() {
return isSpawned;
}
public boolean isOpen() {
if(isSpawned & other.isSpawned)
return other.getCurrentWall().getAdjacentTile(other.getExitDirection()).isSteppable();

View File

@ -10,6 +10,7 @@ public abstract class Tile {
protected Stack<Box> boxStack;
protected int y = -666;
protected int x = -666;
protected PlayerBase playerBaseOnTile = null;
public Tile() {
@ -42,10 +43,15 @@ public abstract class Tile {
}
public void spawnStargate(Stargate stargate, Direction direction) {
if (playerBaseOnTile != null && playerBaseOnTile.name.equals("Replicator"))
playerBaseOnTile.destroy();
adjacentTile.get(direction).spawnStargate(stargate, direction);
}
public abstract void onEntry(PlayerBase playerBase);
public void onEntry(PlayerBase playerBase) {
playerBaseOnTile = playerBase;
}
public abstract void onExit(PlayerBase playerBase);

View File

@ -36,6 +36,7 @@ public class Wall extends Tile {
}
public void onEntry(PlayerBase playerBase) {
super.onEntry(playerBase);
if (sg == null) {
return;
} else {

View File

@ -2,8 +2,8 @@
150
W W W W W
W R W F W
W X O F W
W R F F W
W F O F W
W F F Z W
W W W W W