public final class EntityEdit extends Object
BaseSystem
, EntitySubscription.SubscriptionListener
are informed of changes only after the current system has done processing and the next system
is about to be invoked. This removes the need for systems to defend their subscription lists
and allows for cleaner code and better performance.
Alternatives to edit entities.
- ComponentMapper
is great for concrete changes BaseComponentMapper.create(Entity)
.
Best choice for parameterizing pooled components.
- EntityBuilder
Convenient entity creation. Not useful when pooling.
- EntityTransmuterFactory
Fastest but rigid way of changing entity component compositions.
- Archetype
Fastest, low level, no parameterized components.Modifier and Type | Method and Description |
---|---|
EntityEdit |
add(Component component)
Add a component to this entity.
|
EntityEdit |
add(Component component,
ComponentType type)
Faster adding of components into the entity.
|
<T extends Component> |
create(Class<T> componentKlazz)
Create new instance of component.
|
Entity |
getEntity()
Get target entity of entity edits.
|
int |
getEntityId()
Get target entity id of entity edits.
|
EntityEdit |
remove(Class<? extends Component> type)
Remove component by its type.
|
EntityEdit |
remove(Component component)
Removes the component from this entity.
|
EntityEdit |
remove(ComponentType type)
Removal of components from a entity.
|
String |
toString() |
public <T extends Component> T create(Class<T> componentKlazz)
componentKlazz
- Class to create.public EntityEdit add(Component component)
component
- the component to add to this entity. Does not support packed or pooled.create(Class)
public EntityEdit add(Component component, ComponentType type)
Not necessary to use this, but in some cases you might need the extra performance.
component
- the component to add. Does not support packed or pooled.type
- the type of the componentcreate(Class)
public Entity getEntity()
public int getEntityId()
public EntityEdit remove(Component component)
component
- the component to remove from this entity.public EntityEdit remove(ComponentType type)
remove(Class)
.type
- the type of component to remove from this entitypublic EntityEdit remove(Class<? extends Component> type)
type
- the class type of component to remove from this entityCopyright © 2019. All rights reserved.