diff --git a/cicaprojekt/Scale.java b/cicaprojekt/Scale.java index 591512f..1d3fc49 100644 --- a/cicaprojekt/Scale.java +++ b/cicaprojekt/Scale.java @@ -4,7 +4,6 @@ import java.util.Stack; public class Scale extends Field { private Gate gateConnected; - private Stack itemsOnTile; private int threshold; private int weight; @@ -12,28 +11,34 @@ public class Scale extends Field { public Scale(Gate gate, int threshold){ gateConnected = gate; this.threshold = threshold; - itemsOnTile = new Stack(); + boxStack = new Stack(); } - public void onEntry() { + @Override + public void onEntry(PlayerBase playerBase) { gateConnected.setOpen(true); } - public void onExit() { + @Override + public void onExit(PlayerBase playerBase) { gateConnected.setOpen(false); } @Override - public Pickable removeItemFromTile() { - weight -= itemsOnTile.peek().weight(); + public Box getABox() { + if(boxStack.isEmpty()) + return null; + weight -= boxStack.peek().weight(); stackChanged(); - return itemsOnTile.pop(); + return boxStack.pop(); } @Override - public void setItemOnTile(Pickable item) { - itemsOnTile.push(item); - weight += item.weight(); + public void putABox(Box box) { + if(box == null) + return; + boxStack.push(box); + weight += box.weight(); stackChanged(); }