cicaprojekt/cicaprojekt/Gate.java

46 lines
1.0 KiB
Java
Raw Normal View History

package cicaprojekt;
2016-04-24 21:01:34 +00:00
public class Gate extends Tile {
private boolean open = false;
2016-04-24 21:01:34 +00:00
public Gate() {
super();
}
@Override
2016-04-24 21:01:34 +00:00
public void spawnStargate(Stargate stargate, Direction direction) {
if (this.open) adjacentTile.get(direction).spawnStargate(stargate, direction);
}
2016-04-24 21:01:34 +00:00
public void onEntry(PlayerBase playerBase) {
super.onEntry(playerBase);
2016-04-24 21:01:34 +00:00
if (open) {
playerBase.setCurrentTile(this);
} else
return;
}
2016-04-24 21:01:34 +00:00
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;
}
2016-04-24 21:01:34 +00:00
public boolean isOpen() {
return open;
2016-04-24 21:01:34 +00:00
}
2016-04-24 21:01:34 +00:00
public void setOpen(boolean gateState) {
2016-04-21 21:39:00 +00:00
this.open = gateState;
2016-04-24 21:01:34 +00:00
}
}