Esempio n. 1
0
 @Override
 protected void process(int entityId) {
   ScriptComponent sc = mScript.get(entityId);
   // add pending scripts
   for (Script script : sc.add) {
     world.inject(script, false);
     script.world = world;
     script.inserted(entityId);
     sc.scripts.add(script);
   }
   // removed pending scripts
   sc.add.clear();
   for (Script script : sc.remove) {
     if (sc.scripts.removeValue(script, true)) {
       script.removed(entityId);
     }
   }
   sc.remove.clear();
   // process active scripts
   Iterator<Script> it = sc.scripts.iterator();
   while (it.hasNext()) {
     Script next = it.next();
     next.process(entityId);
     if (next.remove) {
       it.remove();
       next.removed(entityId);
     }
   }
 }
Esempio n. 2
0
 @Override
 protected void removed(int entityId) {
   ScriptComponent sc = mScript.get(entityId);
   for (Script script : sc.scripts) {
     script.removed(entityId);
   }
   sc.scripts.clear();
 }