43 lines
973 B
Java
43 lines
973 B
Java
package cicaprojekt;
|
|
|
|
public class Gate extends Tile {
|
|
private boolean open = false;
|
|
|
|
public Gate() {
|
|
super();
|
|
}
|
|
|
|
@Override
|
|
public void spawnStargate(Stargate stargate, Direction direction) {
|
|
if (this.open) adjacentTile.get(direction).spawnStargate(stargate, direction);
|
|
}
|
|
|
|
public void onEntry(PlayerBase playerBase) {
|
|
super.onEntry(playerBase);
|
|
if (open) playerBase.setCurrentTile(this);
|
|
}
|
|
|
|
public void onExit(PlayerBase playerBase) throws IllegalStateException {
|
|
if (!open) {
|
|
throw new IllegalStateException("Hiba! Te hogy kerültél a csukott ajtóba?");
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public boolean isSteppable()
|
|
{
|
|
if (open)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
public boolean isOpen() {
|
|
return open;
|
|
}
|
|
|
|
public void setOpen(boolean gateState) {
|
|
this.open = gateState;
|
|
}
|
|
}
|