public class ComponentManager extends Manager
Only one component manager exists per World instance,
managed by the world.
| Modifier and Type | Field and Description |
|---|---|
protected ComponentTypeFactory |
typeFactory |
| Modifier | Constructor and Description |
|---|---|
protected |
ComponentManager(int entityContainerSize)
Creates a new instance of
ComponentManager. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addComponent(Entity e,
ComponentType type,
Component component)
Adds the component of the given type to the entity.
|
protected void |
addComponents(Entity e,
ArchetypeBuilder.Archetype archetype) |
void |
added(Entity e)
Called when an entity the observer is interested in is added.
|
protected void |
clean()
Removes all components from entities marked for deletion.
|
protected <T extends Component> |
create(Entity owner,
Class<T> componentClass) |
void |
deleted(Entity e)
Called when an entity the observer is interested in is deleted.
|
protected void |
dispose()
see
World.dispose() |
protected Component |
getComponent(Entity e,
ComponentType type)
Get a component of an entity.
|
protected Bag<Component> |
getComponentsByType(ComponentType type)
Get all components from all entities for a given type.
|
Bag<Component> |
getComponentsFor(Entity e,
Bag<Component> fillBag)
Get all component associated with an entity.
|
protected BitSet |
getPackedComponentOwners(ComponentType type) |
protected void |
removeComponent(Entity e,
ComponentType type)
Removes the component of given type from the entity.
|
protected final ComponentTypeFactory typeFactory
protected ComponentManager(int entityContainerSize)
ComponentManager.protected BitSet getPackedComponentOwners(ComponentType type)
protected void dispose()
ManagerWorld.dispose()protected void addComponent(Entity e, ComponentType type, Component component)
Only one component of given type can be associated with a entity at the same time.
e - the entity to add totype - the type of component being addedcomponent - the component to addprotected void addComponents(Entity e, ArchetypeBuilder.Archetype archetype)
protected void removeComponent(Entity e, ComponentType type)
e - the entity to remove fromtype - the type of component being removedprotected Bag<Component> getComponentsByType(ComponentType type)
type - the type of components to getprotected Component getComponent(Entity e, ComponentType type)
e - the entity associated with the componenttype - the type of component to getpublic Bag<Component> getComponentsFor(Entity e, Bag<Component> fillBag)
e - the entity to get components fromfillBag - a bag to be filled with componentsfillBag, filled with the entities componentspublic void deleted(Entity e)
EntityObserverdeleted in interface EntityObserverdeleted in class Managere - the deleted entitypublic void added(Entity e)
EntityObserveradded in interface EntityObserveradded in class Managere - the added entityprotected void clean()
Copyright © 2014. All Rights Reserved.