private void clearEntities(Room safeArea){ for (Heap heap : heaps.values()){ if (safeArea == null || !safeArea.inside(cellToPoint(heap.pos))){ for (Item item : heap.items) storedItems.add(item); heap.destroy(); } } for (Mob mob : Dungeon.level.mobs.toArray(new Mob[Dungeon.level.mobs.size()])){ if (mob != tengu && (safeArea == null || !safeArea.inside(cellToPoint(mob.pos)))){ mob.destroy(); if (mob.sprite != null) mob.sprite.killAndErase(); } } for (Plant plant : plants.values()){ if (safeArea == null || !safeArea.inside(cellToPoint(plant.pos))){ plants.remove(plant.pos); } } }
private void clearEntities(Room safeArea){ for (Heap heap : heaps.values()){ if (safeArea == null || !safeArea.inside(cellToPoint(heap.pos))){ for (Item item : heap.items) storedItems.add(item); heap.destroy(); } } for (Mob mob : Dungeon.level.mobs.toArray(new Mob[Dungeon.level.mobs.size()])){ if (mob != tengu && (safeArea == null || !safeArea.inside(cellToPoint(mob.pos)))){ mob.destroy(); if (mob.sprite != null) mob.sprite.killAndErase(); } } for (Plant plant : plants.values()){ if (safeArea == null || !safeArea.inside(cellToPoint(plant.pos))){ plants.remove(plant.pos); } } }
@Override public void press( int cell, Char ch ) { super.press(cell, ch); if (ch == Dungeon.hero){ //hero enters tengu's chamber if (state == State.START && (new EmptyRoom().set(2, 25, 8, 32)).inside(cellToPoint(cell))){ progress(); } //hero finishes the maze else if (state == State.MAZE && (new EmptyRoom().set(4, 0, 7, 4)).inside(cellToPoint(cell))){ progress(); } } }
@Override public void press( int cell, Char ch ) { super.press(cell, ch); if (ch == Dungeon.hero){ //hero enters tengu's chamber if (state == State.START && (new EmptyRoom().set(2, 25, 8, 32)).inside(cellToPoint(cell))){ progress(); } //hero finishes the maze else if (state == State.MAZE && (new EmptyRoom().set(4, 0, 7, 4)).inside(cellToPoint(cell))){ progress(); } } }