public void msgRestaurantFull(int waitingSpot) { this.waitingSpot = waitingSpot; int randomChoice = ranGenerator.nextInt(6); // Hacks to demonstrate working code. "patient" will always wait while "impatient" will leave if (name.equals("patient")) { log("I'm in no hurry, I'll wait around."); goingInside = true; person.stateChanged(); return; } if (name.equals("impatient")) { log("I don't have time to wait around!"); event = AgentEvent.leaving; person.stateChanged(); return; } if (randomChoice == 0) { log("I don't have time to wait around!"); event = AgentEvent.leaving; } else if (randomChoice > 0) { log("I'm in no hurry, I'll wait around."); goingInside = true; } person.stateChanged(); }
// ACTIONS private void collectRent(MyTenant mt) { if (!test) { log("Collecting rent now"); } mt.tenant.msgRentDue(this, mt.rate); mt.newPayment = false; p.stateChanged(); }
public void msgAtDestination() { atDestination.release(); person.stateChanged(); }
public void msgAnimationDoneLeaving() { event = AgentEvent.leaving; person.stateChanged(); }
public void msgHereIsYourFood(String choice) { event = AgentEvent.startedEating; person.stateChanged(); }
public void msgHereIsChange(double change) { money += change; event = AgentEvent.leaving; person.stateChanged(); }
public void msgHereIsYourBill(Restaurant1Check c) { check = c; person.stateChanged(); }
public void msgPleaseReorder() { event = AgentEvent.reordering; person.stateChanged(); }
public void msgAtBuilding() { // from animation // print("msgAtBuilding() called"); atBuilding.release(); // = true; stateChanged(); }
public void msgAnimationFinishedGoToSeat() { // from animation event = AgentEvent.seated; person.stateChanged(); }
public void msgFollowMe(Restaurant1WaiterRole w, Restaurant1Menu m) { waiter = w; menu = m; event = AgentEvent.followWaiter; person.stateChanged(); }
public void msgGotHungry() { // from animation log("I'm hungry"); event = AgentEvent.gotHungry; person.stateChanged(); }
public void msgFeelFreeToWait(int spot) { waitingSpot = spot; person.stateChanged(); }
public void msgAtEntrance() { // from animation // print("msgAtEntrance() called"); atEntrance.release(); // = true; stateChanged(); }
public void msgWhatDoYouWant() { event = AgentEvent.askedToOrder; person.stateChanged(); }
public void deactivate() { setRoleInactive = false; p.setRoleInactive(this); p.setGuiVisible(); p.stateChanged(); }
public void msgFire() { emergencyState = EmergencyState.fire; stateChanged(); }