Пример #1
0
 @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);
   }
 }
Пример #2
0
 @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);
   }
 }
Пример #3
0
 @Override
 public void interrupt(final String message) {
   super.interrupt(message);
   if (crafter != null) {
     crafter.setAvailable(true);
   }
   if (resources != null) {
     for (Item resource : resources) {
       resource.setAvailable(true);
     }
   }
 }
Пример #4
0
 @Override
 public boolean containsIndex(final MapIndex mapIndex) {
   return dwarf.getPosition().equals(mapIndex);
 }