Пример #1
0
  private void appendEntities(Room room, NodeList creatures, DeferredStorage.StorageType type)
      throws FactoryException {
    for (int c = 0; c < creatures.getLength(); ++c) {
      Node creatureLink = creatures.item(c);

      String strX = FactoryUtils.getValue(creatureLink, Attributes.ATTR_X);
      String strY = FactoryUtils.getValue(creatureLink, Attributes.ATTR_Y);
      String id = FactoryUtils.getValue(creatureLink, Attributes.ATTR_ID);
      int x = Integer.parseInt(strX);
      int y = Integer.parseInt(strY);

      storage.add(room, id, type, x, y);
    }
  }
Пример #2
0
 public RoomFactory(TextAdventure adventure, EntityFactory<Door> doorFactory) {
   this.adventure = adventure;
   this.doorFactory = doorFactory;
   storage = DeferredStorage.getInstance();
 }