2016-03-27 22:27:24 +00:00
|
|
|
package cicaprojekt;
|
|
|
|
|
2016-04-24 21:01:34 +00:00
|
|
|
public class Gate extends Tile {
|
|
|
|
private boolean open = false;
|
2016-04-21 19:57:45 +00:00
|
|
|
|
2016-04-24 21:01:34 +00:00
|
|
|
public Gate() {
|
|
|
|
super();
|
|
|
|
}
|
2016-03-27 22:27:24 +00:00
|
|
|
|
2016-05-13 16:14:14 +00:00
|
|
|
@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-03-27 22:27:24 +00:00
|
|
|
|
2016-04-24 21:01:34 +00:00
|
|
|
public void onEntry(PlayerBase playerBase) {
|
2016-05-13 21:52:10 +00:00
|
|
|
super.onEntry(playerBase);
|
2016-04-24 21:01:34 +00:00
|
|
|
if (open) {
|
|
|
|
playerBase.setCurrentTile(this);
|
|
|
|
} else
|
|
|
|
return;
|
|
|
|
}
|
2016-03-27 22:27:24 +00:00
|
|
|
|
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?");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-13 15:59:14 +00:00
|
|
|
@Override
|
|
|
|
public boolean isSteppable()
|
|
|
|
{
|
|
|
|
if (open)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-04-24 21:01:34 +00:00
|
|
|
public boolean isOpen() {
|
2016-04-22 08:38:18 +00:00
|
|
|
return open;
|
2016-04-24 21:01:34 +00:00
|
|
|
}
|
2016-04-21 19:57:45 +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
|
|
|
}
|
2016-03-27 22:27:24 +00:00
|
|
|
}
|