Ejemplo n.º 1
0
  Person(String name, double moneyz) {
    this.name = name;
    this.money = moneyz;
    roles.add(new ApartmentResidentRole(this, getName(), "Apartment Resident"));
    roles.add(new HousingResidentRole(this, getName(), "Housing Resident"));
    roles.add(new BankCustomerRole(this, getName(), "Bank Customer"));
    roles.add(new MarketCustomerRole(this, getName(), "Market Customer"));
    roles.add(
        new ChineseRestaurantCustomerRole(
            this,
            getName(),
            "Restaurant Customer",
            Phonebook.getPhonebook().getChineseRestaurant()));
    roles.add(new AmericanRestaurantCustomerRole(this, getName(), "Restaurant Customer"));
    nextTask = new Timer();
    atCityDestination = new Semaphore(0, true);
    setHunger(HungerLevel.full);
    hasFoodInFridge = false;

    // add restaurants to queue
    restaurantQueue = new ArrayList<String>();
    restaurantQueue.add("Chinese Restaurant");
    restaurantQueue.add("American Restaurant");
    restaurantQueue.add("Italian Restaurant");
    //	restaurantQueue.add("Chinese Restaurant");
    restaurantQueue.add("Seafood Restaurant");
  }
Ejemplo n.º 2
0
  protected void startHungerTimer() {
    setHunger(HungerLevel.moderate);

    // After arrives home
    hungerTimer.schedule(
        new TimerTask() {
          public void run() {
            print("I'm hungry...time to eat!");
            setHunger(HungerLevel.hungry);
            stateChanged();
          }
        },
        (12000)); // Check this math please?
  }