/** * 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); }
/** * Build the visual representation of this entity. * * @param entity entity for which to build the representation */ @Override protected void buildRepresentation(IEntity entity) { final SpriteStore store = SpriteStore.get(); ZoneInfo info = ZoneInfo.get(); Sprite sprite = store.getModifiedSprite( translate(getClassResourcePath()), info.getZoneColor(), info.getColorMethod()); setSprite(sprite); }