public abstract class EntitySystem extends BaseEntitySystem implements EntitySubscription.SubscriptionListener
BaseEntitySystem, but uses Entity references instead of int.
This system exists as a convenience for users migrating from other Artemis
clones or older versions of odb. We recommend using the int systems over
the Entity variants.subscriptionworld| Constructor and Description |
|---|
EntitySystem() |
EntitySystem(Aspect.Builder aspect)
Creates an entity system that uses the specified aspect as a matcher
against entities.
|
| Modifier and Type | Method and Description |
|---|---|
Bag<Entity> |
getEntities()
Gets the entities processed by this system.
|
void |
inserted(Entity e)
Called if entity has come into scope for this system, e.g
created or a component was added to it.
|
protected void |
inserted(int entityId)
Called if entity has come into scope for this system, e.g created or a component was added to it.
|
void |
inserted(IntBag entities)
Called after entities match an
EntitySubscription. |
void |
removed(Entity e)
Called if entity has gone out of scope of this system, e.g deleted
or had one of it's components removed.
|
protected void |
removed(int entityId)
Called if entity has gone out of scope of this system, e.g deleted
or had one of it's components removed.
|
void |
removed(IntBag entities)
Called if entity has gone out of scope of this system, e.g deleted
or had one of it's components removed.
|
protected void |
setWorld(World world)
Set the world this system works on.
|
getEntityIds, getSubscriptionbegin, checkProcessing, dispose, end, getWorld, initialize, isEnabled, process, processSystem, setEnabledpublic EntitySystem(Aspect.Builder aspect)
aspect - to match against entitiespublic EntitySystem()
protected void setWorld(World world)
setWorld in class BaseEntitySystemworld - the world to setpublic final void inserted(IntBag entities)
EntitySubscription.SubscriptionListenerEntitySubscription.
Triggers right after a system finishes processing. Adding and immediately removing a component does not
permanently change the composition and will prevent this method from being called.
Not triggered for entities that have been destroyed immediately after being created (within a system).inserted in interface EntitySubscription.SubscriptionListenerinserted in class BaseEntitySystemprotected final void inserted(int entityId)
BaseEntitySysteminserted in class BaseEntitySystementityId - the entity that was added to this systempublic final void removed(IntBag entities)
BaseEntitySystemCalled if entity has gone out of scope of this system, e.g deleted or had one of it's components removed.
Explicitly removed components are only retrievable at this point
if annotated with DelayedComponentRemoval.
Deleted entities retain all their components - until all listeners have been informed.
removed in interface EntitySubscription.SubscriptionListenerremoved in class BaseEntitySystementities - entities removed from this system.protected final void removed(int entityId)
BaseEntitySystemCalled if entity has gone out of scope of this system, e.g deleted or had one of it's components removed.
Important note on accessing components:
Using ComponentMapper.get(int) to retrieve a component is unsafe, unless:
- You annotate the component with DelayedComponentRemoval.
- World.isAlwaysDelayComponentRemoval() is enabled to make accessing all components safe,
for a small performance hit.
ComponentMapper.has(int) always returns false, even for DelayedComponentRemoval components.
Can trigger for entities that have been destroyed immediately after being created (within a system).
removed in class BaseEntitySystementityId - the entity that was removed from this systempublic void inserted(Entity e)
e - the entity that was added to this systempublic void removed(Entity e)
Called if entity has gone out of scope of this system, e.g deleted or had one of it's components removed.
Explicitly removed components are only retrievable at this point
if annotated with DelayedComponentRemoval.
Deleted entities retain all their components - until all listeners have been informed.
e - the entity that was removed from this systemCopyright © 2019. All rights reserved.