@SkipWire public class ComponentManager extends BaseSystem
Only one component manager exists per World
instance,
managed by the world.
Modifier and Type | Field and Description |
---|---|
protected ComponentTypeFactory |
typeFactory |
world
Modifier | Constructor and Description |
---|---|
protected |
ComponentManager(int entityContainerSize)
Creates a new instance of
ComponentManager . |
Modifier and Type | Method and Description |
---|---|
int |
compositionIdentity(BitVector componentBits)
Fetches unique identifier for composition.
|
protected <T extends Component> |
create(int owner,
Class<T> componentClass)
Create a component of given type by class.
|
void |
ensureCapacity(int newSize) |
protected Component |
getComponent(int entityId,
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(int entityId,
Bag<Component> fillBag)
Get all component associated with an entity.
|
ImmutableBag<ComponentType> |
getComponentTypes() |
int |
getIdentity(int entityId)
Fetch composition id for entity.
|
protected <T extends Component> |
getMapper(Class<T> mapper) |
ComponentTypeFactory |
getTypeFactory() |
protected void |
processSystem()
Process the system.
|
begin, checkProcessing, dispose, end, getWorld, initialize, isEnabled, process, setEnabled, setWorld
protected final ComponentTypeFactory typeFactory
protected ComponentManager(int entityContainerSize)
ComponentManager
.protected void processSystem()
BaseSystem
processSystem
in class BaseSystem
protected <T extends Component> T create(int owner, Class<T> componentClass)
owner
- entity idcomponentClass
- class of component to instance.protected <T extends Component> ComponentMapper<T> getMapper(Class<T> mapper)
protected Bag<Component> getComponentsByType(ComponentType type)
type
- the type of components to getpublic ImmutableBag<ComponentType> getComponentTypes()
protected Component getComponent(int entityId, ComponentType type)
entityId
- the entity associated with the componenttype
- the type of component to getpublic Bag<Component> getComponentsFor(int entityId, Bag<Component> fillBag)
entityId
- the entity to get components fromfillBag
- a bag to be filled with componentsfillBag
, filled with the entities componentspublic int compositionIdentity(BitVector componentBits)
componentBits
- composition to fetch unique identifier for.public int getIdentity(int entityId)
entityId
- public ComponentTypeFactory getTypeFactory()
public void ensureCapacity(int newSize)
Copyright © 2019. All rights reserved.