Пример #1
0
  public void storeInBundle(Bundle bundle) {

    backpack.storeInBundle(bundle);

    bundle.put(WEAPON, weapon);
    bundle.put(ARMOR, armor);
    bundle.put(MISC1, misc1);
    bundle.put(MISC2, misc2);
  }
Пример #2
0
  public Belongings(Hero owner) {
    this.owner = owner;

    backpack =
        new Bag() {
          {
            name = "backpack";
            size = BACKPACK_SIZE;
          }
        };
    backpack.owner = owner;
  }
Пример #3
0
  public void restoreFromBundle(Bundle bundle) {

    backpack.clear();
    backpack.restoreFromBundle(bundle);

    weapon = (KindOfWeapon) bundle.get(WEAPON);
    if (weapon != null) {
      weapon.activate(owner);
    }

    armor = (Armor) bundle.get(ARMOR);

    misc1 = (KindofMisc) bundle.get(MISC1);
    if (misc1 != null) {
      misc1.activate(owner);
    }

    misc2 = (KindofMisc) bundle.get(MISC2);
    if (misc2 != null) {
      misc2.activate(owner);
    }
  }