Implemented Stargate spawning correctly

Or at least attemted to
This commit is contained in:
Bokros Bálint 2016-04-26 01:08:37 +02:00
parent 90a2b58c37
commit f6bef6fdde
2 changed files with 15 additions and 2 deletions

View File

@ -29,6 +29,12 @@ public class Stargate {
public void setCurrentWall(Wall wall) { public void setCurrentWall(Wall wall) {
currentWall = wall; currentWall = wall;
if(wall != null) {
isSpawned = true;
}
else {
isSpawned = false;
}
} }
public boolean isOpen() { public boolean isOpen() {

View File

@ -8,14 +8,21 @@ public class Wall extends Tile {
} }
public void spawnStargate(Stargate stargate, Direction direction) { public void spawnStargate(Stargate stargate, Direction direction) {
if (sg == null) clearStargate();
if (sg == null) {
sg = stargate; sg = stargate;
sg.setCurrentWall(this);
}
else else
return; return;
} }
public void clearStargate() { public void clearStargate() {
sg = null; if(sg != null) {
sg.setCurrentWall(null);
sg = null;
}
} }
public void onEntry(PlayerBase playerBase) { public void onEntry(PlayerBase playerBase) {