Пример #1
0
 /**
  * Retrieve a system for specified system type.
  *
  * @param <T> Type of entity system
  * @param type type of system.
  * @return instance of the system in this world.
  */
 @SuppressWarnings("unchecked")
 public <T extends EntitySystem> T getSystem(Class<T> type) {
   for (int i = 0; i < systems.size; i++) {
     EntitySystem system = systems.get(i);
     if (system.getClass().equals(type)) {
       return (T) system;
     }
   }
   return null;
 }
Пример #2
0
  /** Process all non-passive systems. */
  public void process() {
    check(added, addedPerformer);
    check(changed, changedPerformer);
    check(disable, disablePerformer);
    check(enable, enablePerformer);
    check(deleted, deletedPerformer);

    cm.clean();
    em.clean();

    if (eventSystem != null) {
      eventSystem.update();
    }

    for (int i = 0; i < systems.size; i++) {
      EntitySystem system = systems.get(i);
      if (!system.isPassive()) {
        system.process();
      }
    }
  }