@Override
 public void update(EntityWorld entityWorld, float deltaSeconds) {
   ComponentMapObserver observer =
       entityWorld.requestObserver(this, TriggeredEffectComponent.class);
   for (int entity : observer.getRemoved().getEntitiesWithAll(TriggeredEffectComponent.class)) {
     int effectEntity =
         observer
             .getRemoved()
             .getComponent(entity, TriggeredEffectComponent.class)
             .getEffectEntity();
     CleanupUtil.tryCleanupEntity(entityWorld, effectEntity);
   }
   for (int effectTriggerEntity : entityWorld.getEntitiesWithAll(TriggerSourceComponent.class)) {
     int sourceEntity =
         entityWorld
             .getComponent(effectTriggerEntity, TriggerSourceComponent.class)
             .getSourceEntity();
     if (!entityWorld.hasEntity(sourceEntity)) {
       int effectEntity =
           entityWorld
               .getComponent(effectTriggerEntity, TriggeredEffectComponent.class)
               .getEffectEntity();
       CleanupUtil.tryCleanupEntity(entityWorld, effectEntity);
       entityWorld.removeEntity(effectTriggerEntity);
     }
   }
 }
Ejemplo n.º 2
0
 @Override
 public void update(EntityWorld entityWorld, float deltaSeconds) {
   ComponentMapObserver observer =
       entityWorld.requestObserver(
           this, AreaBuffComponent.class, AreaBuffTargetRulesComponent.class);
   for (int entity : observer.getRemoved().getEntitiesWithAll(AreaBuffComponent.class)) {
     int buffEntity =
         observer.getRemoved().getComponent(entity, AreaBuffComponent.class).getBuffEntity();
     CleanupUtil.tryCleanupEntity(entityWorld, buffEntity);
   }
   for (int entity :
       observer.getRemoved().getEntitiesWithAll(AreaBuffTargetRulesComponent.class)) {
     int targetRulesEntity =
         observer
             .getRemoved()
             .getComponent(entity, AreaBuffTargetRulesComponent.class)
             .getTargetRulesEntity();
     CleanupUtil.tryCleanupEntity(entityWorld, targetRulesEntity);
   }
 }