use of de.gurkenlabs.litiengine.graphics.StaticShadow in project litiengine by gurkenlabs.
the class MapSelectionPanel method populateMapObjectTree.
private void populateMapObjectTree() {
this.nodeRoot.setUserObject(new IconTreeListItem(Game.getEnvironment().getEntities().size() + " " + Resources.get("panel_mapselection_entities"), Icons.FOLDER));
for (DefaultMutableTreeNode node : this.entityNodes) {
node.removeAllChildren();
}
this.nodeLights.setUserObject(new IconTreeListItem(Game.getEnvironment().getLightSources().size() + " " + Resources.get("panel_mapselection_lights"), Icons.LIGHT));
this.nodeProps.setUserObject(new IconTreeListItem(Game.getEnvironment().getProps().size() + " " + Resources.get("panel_mapselection_props"), Icons.PROP));
this.nodeCreatures.setUserObject(new IconTreeListItem(Game.getEnvironment().getCreatures().size() + " " + Resources.get("panel_mapselection_creatures"), Icons.CREATURE));
this.nodeTriggers.setUserObject(new IconTreeListItem(Game.getEnvironment().getTriggers().size() + " " + Resources.get("panel_mapselection_triggers"), Icons.TRIGGER));
this.nodeSpawnpoints.setUserObject(new IconTreeListItem(Game.getEnvironment().getSpawnPoints().size() + " " + Resources.get("panel_mapselection_spawnpoints"), Icons.SPAWMPOINT));
this.nodeCollisionBoxes.setUserObject(new IconTreeListItem(Game.getEnvironment().getCollisionBoxes().size() + " " + Resources.get("panel_mapselection_collboxes"), Icons.COLLISIONBOX));
this.nodeMapAreas.setUserObject(new IconTreeListItem(Game.getEnvironment().getAreas().size() + " " + Resources.get("panel_mapselection_areas"), Icons.MAPAREA));
this.nodeStaticShadows.setUserObject(new IconTreeListItem(Game.getEnvironment().getStaticShadows().size() + " " + Resources.get("panel_mapselection_shadow"), Icons.SHADOWBOX));
this.nodeEmitter.setUserObject(new IconTreeListItem(Game.getEnvironment().getEmitters().size() + " " + Resources.get("panel_mapselection_emitter"), Icons.EMITTER));
for (LightSource light : Game.getEnvironment().getLightSources()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new IconTreeListItem(light));
this.nodeLights.add(node);
}
for (Prop prop : Game.getEnvironment().getProps()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new IconTreeListItem(prop));
this.nodeProps.add(node);
}
for (Creature creature : Game.getEnvironment().getCreatures()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new IconTreeListItem(creature));
this.nodeCreatures.add(node);
}
for (Trigger trigger : Game.getEnvironment().getTriggers()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new IconTreeListItem(trigger));
this.nodeTriggers.add(node);
}
for (Spawnpoint spawn : Game.getEnvironment().getSpawnPoints()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new IconTreeListItem(spawn));
this.nodeSpawnpoints.add(node);
}
for (CollisionBox coll : Game.getEnvironment().getCollisionBoxes()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new IconTreeListItem(coll));
this.nodeCollisionBoxes.add(node);
}
for (MapArea area : Game.getEnvironment().getAreas()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new IconTreeListItem(area));
this.nodeMapAreas.add(node);
}
for (StaticShadow shadow : Game.getEnvironment().getStaticShadows()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new IconTreeListItem(shadow));
this.nodeStaticShadows.add(node);
}
for (Emitter emitter : Game.getEnvironment().getEmitters()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new IconTreeListItem(emitter));
this.nodeEmitter.add(node);
}
this.entitiesTreeModel.reload();
}
use of de.gurkenlabs.litiengine.graphics.StaticShadow in project litiengine by gurkenlabs.
the class Environment method remove.
@Override
public void remove(final IEntity entity) {
if (entity == null) {
return;
}
if (this.entities.get(entity.getRenderType()) != null) {
this.entities.get(entity.getRenderType()).entrySet().removeIf(e -> e.getValue().getMapId() == entity.getMapId());
}
for (String tag : entity.getTags()) {
if (this.entitiesByTag.containsKey(tag)) {
this.entitiesByTag.get(tag).remove(entity);
if (this.entitiesByTag.get(tag).isEmpty()) {
this.entitiesByTag.remove(tag);
}
}
}
if (entity instanceof Emitter) {
Emitter emitter = (Emitter) entity;
this.groundRenderable.remove(emitter.getGroundRenderable());
this.overlayRenderable.remove(emitter.getOverlayRenderable());
this.emitters.remove(emitter);
}
if (entity instanceof MapArea) {
this.mapAreas.remove(entity);
}
if (entity instanceof Prop) {
this.props.remove(entity);
}
if (entity instanceof Creature) {
this.creatures.remove(entity);
}
if (entity instanceof CollisionBox) {
this.colliders.remove(entity);
this.staticShadows.removeIf(x -> x.getOrigin() != null && x.getOrigin().equals(entity));
}
if (entity instanceof LightSource) {
this.lightSources.remove(entity);
this.updateColorLayers(entity);
}
if (entity instanceof Trigger) {
this.triggers.remove(entity);
}
if (entity instanceof Spawnpoint) {
this.spawnPoints.remove(entity);
}
if (entity instanceof StaticShadow) {
this.staticShadows.remove(entity);
this.updateColorLayers(entity);
}
if (entity instanceof IMobileEntity) {
this.mobileEntities.values().remove(entity);
}
if (entity instanceof ICombatEntity) {
this.combatEntities.values().remove(entity);
}
this.unload(entity);
for (Consumer<IEntity> cons : this.entityRemovedConsumers) {
cons.accept(entity);
}
}
Aggregations