public void deliverTo(GameObject takeFrom, GameObject bringTo, ressourceStack stack) { print(this.name + " is delivering to: " + bringTo); lastTarget = null; if (stack.getAmount() > this.GetComponent <inventory>().maxSize) { stack.setAmount(this.GetComponent <inventory>().maxSize); } if (this.GetComponent <inventory>().maxSize - this.GetComponent <inventory>().getAmount() < stack.getAmount()) { Debug.Log("mover is idle and not enough inv space to deliver, emptying now (inv:)" + this.GetComponent <inventory>()); goToBase(); target = null; return; } curState = State.ConstructionDelivering; this.setTarget(takeFrom); deliverTarget = bringTo; deliverFrom = takeFrom; delivery = stack; idleTimer = 0; GetComponent <movementController>().setTarget(takeFrom.transform); }
public void add(ressourceStack stack) { this.newContent[stack.getRessource()] += stack.getAmount(); }
public void remove(ressourceStack stack) { newContent[stack.getRessource()] -= stack.getAmount(); }
//checks if there's enough ressources to be taken public bool canTake(ressourceStack stack) { return(newContent[stack.getRessource()] >= stack.getAmount()); }