Пример #1
0
  /**
   * 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);
    }
  }
Пример #2
0
 private void addStash(T key) {
   if (stashSize == stashCapacity) {
     // Too many pushes occurred and the stash is full, increase the table size.
     resize(capacity << 1);
     add(key);
     return;
   }
   // Store key in the stash.
   int index = capacity + stashSize;
   keyTable[index] = key;
   stashSize++;
   size++;
 }
Пример #3
0
 public void addAll(ObjectSet<T> set) {
   ensureCapacity(set.size);
   for (T key : set) add(key);
 }
Пример #4
0
 public void addAll(T[] array, int offset, int length) {
   ensureCapacity(length);
   for (int i = offset, n = i + length; i < n; i++) add(array[i]);
 }
Пример #5
0
 // 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);
 }
Пример #6
0
 /**
  * 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);
 }
Пример #7
0
 /**
  * (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);
 }
Пример #8
0
 /**
  * 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);
 }
Пример #9
0
 /**
  * Adds a entity to this world.
  *
  * @param e entity
  */
 public void addEntity(Entity e) {
   added.add(e);
 }