Implemented teleport in Stargate

This commit is contained in:
Bokros Bálint 2016-04-25 22:16:18 +02:00
parent 2f5f93dd86
commit 9013bd44d7

View File

@ -35,7 +35,19 @@ public class Stargate {
return isSpawned & other.isSpawned;
}
public void teleport(Direction incomingDirection) {
private Direction getExitDirection() {
if(currentWall.getAdjacentTile(Direction.EAST) == null)
return Direction.WEST;
else if(currentWall.getAdjacentTile(Direction.WEST) == null)
return Direction.EAST;
else if(currentWall.getAdjacentTile(Direction.NORTH) == null)
return Direction.SOUTH;
else
return Direction.NORTH;
}
public void teleport(PlayerBase player) {
player.setCurrentTile(other.getCurrentWall().getAdjacentTile(getExitDirection()));
}
@Override