Пример #1
0
  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();
  }
Пример #2
0
 // ACTIONS
 private void collectRent(MyTenant mt) {
   if (!test) {
     log("Collecting rent now");
   }
   mt.tenant.msgRentDue(this, mt.rate);
   mt.newPayment = false;
   p.stateChanged();
 }
Пример #3
0
 public void msgAtDestination() {
   atDestination.release();
   person.stateChanged();
 }
Пример #4
0
 public void msgAnimationDoneLeaving() {
   event = AgentEvent.leaving;
   person.stateChanged();
 }
Пример #5
0
 public void msgHereIsYourFood(String choice) {
   event = AgentEvent.startedEating;
   person.stateChanged();
 }
Пример #6
0
 public void msgHereIsChange(double change) {
   money += change;
   event = AgentEvent.leaving;
   person.stateChanged();
 }
Пример #7
0
 public void msgHereIsYourBill(Restaurant1Check c) {
   check = c;
   person.stateChanged();
 }
Пример #8
0
 public void msgPleaseReorder() {
   event = AgentEvent.reordering;
   person.stateChanged();
 }
Пример #9
0
 public void msgAtBuilding() { // from animation
   // print("msgAtBuilding() called");
   atBuilding.release(); // = true;
   stateChanged();
 }
Пример #10
0
 public void msgAnimationFinishedGoToSeat() {
   // from animation
   event = AgentEvent.seated;
   person.stateChanged();
 }
Пример #11
0
 public void msgFollowMe(Restaurant1WaiterRole w, Restaurant1Menu m) {
   waiter = w;
   menu = m;
   event = AgentEvent.followWaiter;
   person.stateChanged();
 }
Пример #12
0
 public void msgGotHungry() { // from animation
   log("I'm hungry");
   event = AgentEvent.gotHungry;
   person.stateChanged();
 }
Пример #13
0
 public void msgFeelFreeToWait(int spot) {
   waitingSpot = spot;
   person.stateChanged();
 }
Пример #14
0
 public void msgAtEntrance() { // from animation
   // print("msgAtEntrance() called");
   atEntrance.release(); // = true;
   stateChanged();
 }
Пример #15
0
 public void msgWhatDoYouWant() {
   event = AgentEvent.askedToOrder;
   person.stateChanged();
 }
Пример #16
0
 public void deactivate() {
   setRoleInactive = false;
   p.setRoleInactive(this);
   p.setGuiVisible();
   p.stateChanged();
 }
Пример #17
0
 public void msgFire() {
   emergencyState = EmergencyState.fire;
   stateChanged();
 }