예제 #1
0
  /**
   * Populate named state sprites.
   *
   * @param map The map to populate.
   */
  @Override
  protected void buildSprites(Door entity, final Map<Object, Sprite> map) {
    final String name = entity.getEntityClass();

    final SpriteStore store = SpriteStore.get();

    if (name == null) {
      width = IGameScreen.SIZE_UNIT_PIXELS;
      height = IGameScreen.SIZE_UNIT_PIXELS;

      final Sprite emptySprite = store.getEmptySprite(width, height);

      map.put(STATE_OPEN, emptySprite);
      map.put(STATE_CLOSED, emptySprite);
    } else {
      ZoneInfo info = ZoneInfo.get();
      final Sprite tiles =
          store.getModifiedSprite(translate(name), info.getZoneColor(), info.getColorMethod());

      width = tiles.getWidth();
      height = tiles.getHeight() / 2;

      map.put(STATE_OPEN, store.getTile(tiles, 0, 0, width, height));
      map.put(STATE_CLOSED, store.getTile(tiles, 0, height, width, height));
    }

    calculateOffset(entity, width, height);
  }
예제 #2
0
 /**
  * Get the current entity state.
  *
  * @param entity
  * @return The current state.
  */
 @Override
 protected Object getState(Door entity) {
   if (entity.isOpen()) {
     return STATE_OPEN;
   } else {
     return STATE_CLOSED;
   }
 }