@SkipWire public class EntityLinkManager extends BaseEntitySystem
Maintains relationships between entities.
This system is optional and must be manually registered with the world instance.
EntityId
subscription
world
Constructor and Description |
---|
EntityLinkManager()
Processes all fields, even if they don't have a
LinkListener . |
EntityLinkManager(boolean processSitesEvenIfNoListener,
boolean fireEventsOnRegistration) |
Modifier and Type | Method and Description |
---|---|
protected void |
initialize()
Override to implement code that gets executed when systems are
initialized.
|
protected void |
processSystem()
Process the system.
|
void |
register(Class<? extends Component> component,
LinkListener listener)
Injects and associates the listener with the component.
|
void |
register(Class<? extends Component> component,
String field,
LinkListener listener)
Injects and associates the listener with a specific field for a given
component type.
|
getEntityIds, getSubscription, inserted, inserted, removed, removed, setWorld
begin, checkProcessing, dispose, end, getWorld, isEnabled, process, setEnabled
public EntityLinkManager(boolean processSitesEvenIfNoListener, boolean fireEventsOnRegistration)
processSitesEvenIfNoListener
- If true, only act on fields with an attached LinkListener
.fireEventsOnRegistration
- If true,public EntityLinkManager()
LinkListener
.
LinkListener events will be fired when the listener is registered.protected void initialize()
BaseSystem
initialize
in class BaseSystem
protected void processSystem()
BaseSystem
processSystem
in class BaseSystem
public void register(Class<? extends Component> component, LinkListener listener)
Injects and associates the listener with the component. This method is only recommended if only a single field references entities, or if all entity fields are of the same type.
Each ComponentType::Field
pair can only have one LinkListener
component
- component type associated with listenerlistener
- link listenerpublic void register(Class<? extends Component> component, String field, LinkListener listener)
Injects and associates the listener with a specific field for a given component type.
Each ComponentType::Field
pair can only have one LinkListener
component
- component type associated with listenerfield
- target field for listenerlistener
- link listenerCopyright © 2019. All rights reserved.