56 lines
1.2 KiB
Java
56 lines
1.2 KiB
Java
package cicaprojekt;
|
|
|
|
public class Wall extends Tile {
|
|
private Stargate sg = null;
|
|
|
|
public Wall() {
|
|
super();
|
|
}
|
|
|
|
@Override
|
|
public void spawnStargate(Stargate stargate, Direction direction) {
|
|
if(stargate.isSpawned())
|
|
stargate.getCurrentWall().clearStargate();
|
|
if (sg == null) {
|
|
sg = stargate;
|
|
sg.setCurrentWall(this, direction);
|
|
Game.instance.updateDisplay();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public boolean isSteppable() {
|
|
if(sg != null)
|
|
return sg.isOpen();
|
|
return false;
|
|
}
|
|
|
|
public void clearStargate() {
|
|
if(sg != null) {
|
|
sg.setCurrentWall(null, null);
|
|
sg = null;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public boolean boxPermission()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public void onEntry(PlayerBase playerBase) {
|
|
super.onEntry(playerBase);
|
|
if (sg != null)
|
|
sg.teleport(playerBase);
|
|
}
|
|
|
|
@Override
|
|
public void onExit(PlayerBase playerBase) {
|
|
}
|
|
|
|
public Stargate getStargate() {
|
|
return sg;
|
|
}
|
|
}
|