@Override public void render(final Graphics graphics, final MapArea viewArea) { MapIndex position = goblin.getPosition(); if (viewArea.containesIndex(position)) { int x = (position.x - viewArea.pos.x) * SpriteManager.SPRITE_SIZE; int y = (position.y - viewArea.pos.y) * SpriteManager.SPRITE_SIZE; Sprite goblinSprite = SpriteManager.getInstance().getItemSprite(0); goblinSprite.draw(graphics, x, y); } }
@Override public void render(final Graphics graphics, final MapArea viewArea) { MapIndex position = dwarf.getPosition(); if (viewArea.containesIndex(position)) { int x = (position.x - viewArea.pos.x) * SpriteManager.SPRITE_SIZE; int y = (position.y - viewArea.pos.y) * SpriteManager.SPRITE_SIZE; Sprite dwarfSprite; if (dwarf.isDead()) { dwarfSprite = SpriteManager.getInstance().getItemSprite(SpriteManager.DEAD_DWARF_SPRITE); } else { LaborType profession = dwarf.getComponent(ISkillComponent.class).getProfession(); dwarfSprite = SpriteManager.getInstance().getItemSprite(profession.sprite); } dwarfSprite.draw(graphics, x, y); } }