From fd64fd9165c2ff7c65bbde38f362b06d09cea8ad Mon Sep 17 00:00:00 2001 From: ericnerdo Date: Sun, 24 Apr 2016 22:36:20 +0200 Subject: [PATCH] Gate - finished --- cicaprojekt/Gate.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cicaprojekt/Gate.java b/cicaprojekt/Gate.java index e67e526..e64ecdd 100644 --- a/cicaprojekt/Gate.java +++ b/cicaprojekt/Gate.java @@ -4,15 +4,26 @@ public class Gate extends Tile { private boolean open = false; - + public Gate(){ + super(); + } + public void spawnStargate(Stargate stargate, Direction direction) { if(this.open) adjacentTile.get(direction).spawnStargate(stargate, direction); } - public void onEntry() { + public void onEntry(PlayerBase playerBase) { + if(open){ + playerBase.setCurrentTile(this); + } + else + return; } - public void onExit() { + public void onExit(PlayerBase playerBase) throws IllegalStateException { + if(!open){ + throw new IllegalStateException("Hiba! Te hogy kerültél a csukott ajtóba?"); + } } public boolean isOpen() {