public class EntitySubscription extends Object
World.process()
.
Any listeners
are informed when entities are added or removed.
Be careful! Subscriptions do not immediately reflect changes by the
active system. Subscriptions only guarantee contained entities matched
before the current system started processing. Access entities and
components defensively.Modifier and Type | Class and Description |
---|---|
static class |
EntitySubscription.SubscriptionExtra |
static interface |
EntitySubscription.SubscriptionListener
This interfaces reports entities inserted or
removed when matched against their
EntitySubscription |
Modifier and Type | Method and Description |
---|---|
void |
addSubscriptionListener(EntitySubscription.SubscriptionListener listener)
Add listener interested in changes to the subscription.
|
BitVector |
getActiveEntityIds()
Returns the bitset tracking all matched entities.
|
Aspect |
getAspect() |
Aspect.Builder |
getAspectBuilder() |
IntBag |
getEntities()
Returns a reference to the bag holding all matched entities.
|
void |
removeSubscriptionListener(EntitySubscription.SubscriptionListener listener)
Remove previously registered listener.
|
String |
toString() |
public IntBag getEntities()
Warning: Never remove elements from the bag, as this will lead to undefined behavior.
public BitVector getActiveEntityIds()
Warning: Never toggle bits in the bitset, as this may lead to erroneously added or removed entities.
public Aspect getAspect()
public Aspect.Builder getAspectBuilder()
public void addSubscriptionListener(EntitySubscription.SubscriptionListener listener)
listener
- listener to add.public void removeSubscriptionListener(EntitySubscription.SubscriptionListener listener)
listener
- listener to remove.Copyright © 2019. All rights reserved.