/** * Delete the entity from the world. * * @param e Entity to remove */ public void deleteEntity(Entity e) { if (!deleted.contains(e)) { deleted.add(e); } if (added.contains(e)) { added.remove(e); } }
/** * Performs an action on each entity. * * @param entities * @param performer */ protected void check(ObjectSet<Entity> entities, Performer performer) { if (entities.size > 0) { for (Entity e : entities) { notifyManagers(performer, e); notifySystems(performer, e); } entities.clear(); } }
public void remove() { if (currentIndex < 0) throw new IllegalStateException("next must be called before remove."); if (currentIndex >= set.capacity) { set.removeStashIndex(currentIndex); } else { set.keyTable[currentIndex] = null; } currentIndex = -1; set.size--; }
@Override public void dispose() { em.dispose(); cm.dispose(); added.clear(); changed.clear(); deleted.clear(); enable.clear(); disable.clear(); for (Manager manager : managers) { manager.dispose(); } managers.clear(); systems.clear(); if (eventSystem != null) { eventSystem.dispose(); eventSystem = null; } }
private static void cleanRemovableBodies() { ///// WORLD Step////////CleanStuff// if (removableBodies.size > 0) { boolean clearRemovable = false; for (Body body : removableBodies) { body.setActive( false); // Body wont be active while it waits deletion; This must happen outside the // Step process; if (!WORLD.isLocked()) { WORLD.destroyBody(body); clearRemovable = true; } } if (clearRemovable) { removableBodies.clear(); // collisionPairsDictionary.clear(); } } ///// WORLD Step////////CleanStuff// }
public void clear() { items.clear(); super.clear(); }
public void clear(int maximumCapacity) { items.clear(); super.clear(maximumCapacity); }
// Destroy bodies from Poolable or Non-Poolable objects public static void destroyBody(Body body) { // body.setActive(false); //Body wont be active while it waits deletion; //Da problema!! removableBodies.add(body); }
/** * Disable the entity from being processed. Won't delete it, it will continue to exist but won't * get processed. * * @param e entity to disable */ public void disable(Entity e) { disable.add(e); }
/** * (Re)enable the entity in the world, after it having being disabled. Won't do anything unless it * was already disabled. * * @param e entity to enable */ public void enable(Entity e) { enable.add(e); }
/** * Ensure all systems are notified of changes to this entity. If you're adding a component to an * entity after it's been added to the world, then you need to invoke this method. * * @param e entity */ public void changedEntity(Entity e) { changed.add(e); }
/** * Adds a entity to this world. * * @param e entity */ public void addEntity(Entity e) { added.add(e); }