/** * Gets the entities processed by this system. Do not delete entities from * this bag - it is the live thing. * * @return System's entity ids, as matched by aspect. */ public IntBag getEntityIds() { return subscription.getEntities(); }
protected void setWorld(World world) { super.setWorld(world); subscriptionA = getSubscription(matcherA); subscriptionB = getSubscription(matcherB); subscriptionA.addSubscriptionListener(this); subscriptionB.addSubscriptionListener(this); }
/** * Synchronizes new subscriptions with {@link World} state. * * @param es entity subscription to update. */ void synchronize(EntitySubscription es) { Bag<BitVector> compositionBits = identityResolver.compositionBits; for (int i = 1, s = compositionBits.size(); s > i; i++) { BitVector componentBits = compositionBits.get(i); es.processComponentIdentity(i, componentBits); } for (Entity e : world.getEntityManager().entities) { if (e != null) es.check(e.id, getIdentity(e.id)); } es.informEntityChanges(); es.rebuildCompressedActives(); }
void process(IntBag changed, IntBag deleted) { deleted(deleted); changed(changed); informEntityChanges(); }
void processAll(IntBag changed, IntBag deleted) { deletedAll(deleted); changed(changed); informEntityChanges(); }
@Override public void validate(int sourceId, IntBag ids, LinkListener listener) { for (int i = 0; ids.size() > i; i++) { int id = ids.get(i); if (!all.getActiveEntityIds().unsafeGet(id)) { ids.remove(i--); if (listener != null) listener.onTargetDead(sourceId, id); } } }
protected LinkSite(World world, ComponentType type, Field field, LinkPolicy.Policy defaultPolicy) { this.type = type; this.field = field; LinkPolicy.Policy policyOverride = LinkFactory.getPolicy(field); this.policy = (policyOverride != null) ? policyOverride : defaultPolicy; mapper = world.getMapper(type.getType()); activeEntityIds = world.getAspectSubscriptionManager().get(all()).getActiveEntityIds(); AspectSubscriptionManager subscriptions = world.getAspectSubscriptionManager(); subscription = subscriptions.get(all(type.getType())); subscription.addSubscriptionListener(this); }
void processComponentIdentity(int id, BitVector componentBits) { for (int i = 0, s = subscriptions.size(); s > i; i++) { subscriptions.get(i).processComponentIdentity(id, componentBits); } }
/** * Returns a reference to the bag holding all matched entities. * * <p><b>Warning: </b> Never remove elements from the bag, as this * will lead to undefined behavior.</p> * * @return View of all active entities. */ public IntBag getEntities() { if (entities.isEmpty() && !activeEntityIds.isEmpty()) rebuildCompressedActives(); return entities; }
@Override public void validate(int sourceId, IntBag ids, LinkListener listener) { for (int i = 0; ids.size() > i; i++) { int id = ids.get(i); if (!all.getActiveEntityIds().unsafeGet(id)) { ids.remove(i--); if (listener != null) listener.onTargetDead(sourceId, id); } } }
void process(IntBag changed, IntBag deleted) { deleted(deleted); changed(changed); informEntityChanges(); }
void processAll(IntBag changed, IntBag deleted) { deletedAll(deleted); changed(changed); informEntityChanges(); }
protected LinkSite(World world, ComponentType type, Field field, LinkPolicy.Policy defaultPolicy) { this.type = type; this.field = field; LinkPolicy.Policy policyOverride = LinkFactory.getPolicy(field); this.policy = (policyOverride != null) ? policyOverride : defaultPolicy; mapper = world.getMapper(type.getType()); activeEntityIds = world.getAspectSubscriptionManager().get(all()).getActiveEntityIds(); AspectSubscriptionManager subscriptions = world.getAspectSubscriptionManager(); subscription = subscriptions.get(all(type.getType())); subscription.addSubscriptionListener(this); }
void processComponentIdentity(int id, BitVector componentBits) { for (int i = 0, s = subscriptions.size(); s > i; i++) { subscriptions.get(i).processComponentIdentity(id, componentBits); } }
/** * Returns a reference to the bag holding all matched entities. * * <p><b>Warning: </b> Never remove elements from the bag, as this * will lead to undefined behavior.</p> * * @return View of all active entities. */ public IntBag getEntities() { if (entities.isEmpty() && !activeEntityIds.isEmpty()) rebuildCompressedActives(); return entities; }
/** * Gets the entities processed by this system. Do not delete entities from * this bag - it is the live thing. * * @return System's entity ids, as matched by aspect. */ public IntBag getEntityIds() { return subscription.getEntities(); }
/** * Synchronizes new subscriptions with {@link World} state. * * @param es entity subscription to update. */ void synchronize(EntitySubscription es) { Bag<BitVector> compositionBits = identityResolver.compositionBits; for (int i = 1, s = compositionBits.size(); s > i; i++) { BitVector componentBits = compositionBits.get(i); es.processComponentIdentity(i, componentBits); } for (Entity e : world.getEntityManager().entities) { if (e != null) es.check(e.id, getIdentity(e.id)); } es.informEntityChanges(); es.rebuildCompressedActives(); }
protected void setWorld(World world) { super.setWorld(world); subscriptionA = getSubscription(matcherA); subscriptionB = getSubscription(matcherB); subscriptionA.addSubscriptionListener(this); subscriptionB.addSubscriptionListener(this); }
@Override public void validate(int sourceId, IntBag ids, LinkListener listener) { for (int i = 0; ids.size() > i; i++) { int id = ids.get(i); if (!all.getActiveEntityIds().unsafeGet(id)) { ids.remove(i--); if (listener != null) listener.onTargetDead(sourceId, id); } } }
public SaveFileFormat(EntitySubscription es) { this(es.getEntities()); }