Contents
- Description
- Method Summary
- Method Details
- getComponent(Ref, ComponentType)
- ensureAndGetComponent(Ref, ComponentType)
- getArchetype(Ref)
- getResource(ResourceType)
- getExternalData()
- putComponent(Ref, ComponentType, T)
- addComponent(Ref, ComponentType, T)
- addComponent(Ref, ComponentType)
- addEntities(Holder[], AddReason)
- addEntity(Holder, AddReason)
- removeEntity(Ref, Holder, RemoveReason)
- removeComponent(Ref, ComponentType)
- tryRemoveComponent(Ref, ComponentType)
- invoke(Ref, Event)
- invoke(EntityEventType, Ref, Event)
- invoke(Holder, Event)
- invoke(EntityHolderEventType, Holder, Event)
- invoke(Event)
- invoke(WorldEventType, Event)
Interface ComponentAccessor<ECS_TYPE>
- Type Parameters:
ECS_TYPE- The store type associated with this component accessor.
- All Known Implementing Classes:
CommandBuffer, Store
public interface ComponentAccessor<ECS_TYPE>
Allows access to components in logic that might only have access to the
CommandBuffer but not the Store and vice versa depending
on from where it's called.-
Method Summary
Modifier and TypeMethodDescriptionaddComponent(Ref<ECS_TYPE> ref, ComponentType<ECS_TYPE, T> componentType) Adds and returns the given component to the given entity reference.addComponent(Ref<ECS_TYPE> ref, ComponentType<ECS_TYPE, T> componentType, T component) Adds the given component to the given entity reference.addEntities(Holder<ECS_TYPE>[] holders, AddReason reason) Adds the given entities to the store of this component accessor.Adds the given entity to the store of this component accessor.ensureAndGetComponent(Ref<ECS_TYPE> ref, ComponentType<ECS_TYPE, T> componentType) Ensures and fetches the component instance of the given type for the given entity reference.getArchetype(Ref<ECS_TYPE> ref) Fetches the archetype for the given entity reference.getComponent(Ref<ECS_TYPE> ref, ComponentType<ECS_TYPE, T> componentType) Fetches the component instance of the given type for the given entity reference.getResource(ResourceType<ECS_TYPE, T> resourceType) Fetches a resource from the given resource type.<Event extends EcsEvent>
voidinvoke(EntityEventType<ECS_TYPE, Event> systemType, Ref<ECS_TYPE> ref, Event param) <Event extends EcsEvent>
voidinvoke(EntityHolderEventType<ECS_TYPE, Event> systemType, Holder<ECS_TYPE> holder, Event param) <Event extends EcsEvent>
voidinvoke(WorldEventType<ECS_TYPE, Event> systemType, Event param) <Event extends EcsEvent>
void<Event extends EcsEvent>
void<Event extends EcsEvent>
voidinvoke(Event param) putComponent(Ref<ECS_TYPE> ref, ComponentType<ECS_TYPE, T> componentType, T component) Called to put the given component onto the given entity.removeComponent(Ref<ECS_TYPE> ref, ComponentType<ECS_TYPE, T> componentType) Called to remove the component of the given type from the given entity.removeEntity(Ref<ECS_TYPE> ref, Holder<ECS_TYPE> holder, RemoveReason reason) Called to remove the given entity from the store of this component accessor.tryRemoveComponent(Ref<ECS_TYPE> ref, ComponentType<ECS_TYPE, T> componentType) Called to try to remove the component og the given type from the given entity.
-
Method Details
-
getComponent
@Nullable <T extends Component<ECS_TYPE>> T getComponent(@Nonnull Ref<ECS_TYPE> ref, @Nonnull ComponentType<ECS_TYPE, T> componentType) Fetches the component instance of the given type for the given entity reference.- Type Parameters:
T- The component class type.- Parameters:
ref- The entity reference that we are fetching the component for.componentType- The component type of the component.- Returns:
- the component of the reference, or
nullif one doesn't exist.
-
ensureAndGetComponent
@Nonnull <T extends Component<ECS_TYPE>> T ensureAndGetComponent(@Nonnull Ref<ECS_TYPE> ref, @Nonnull ComponentType<ECS_TYPE, T> componentType) Ensures and fetches the component instance of the given type for the given entity reference.- Type Parameters:
T- The component class type.- Parameters:
ref- The entity reference that we are fetching the component for.componentType- The component type of the component.- Returns:
- the component of the reference.
-
getArchetype
-
getResource
@Nonnull <T extends Resource<ECS_TYPE>> T getResource(@Nonnull ResourceType<ECS_TYPE, T> resourceType) Fetches a resource from the given resource type.- Type Parameters:
T- The resource type.- Parameters:
resourceType- The resource type to fetch.- Returns:
- the
Resourceof the given class type.
-
getExternalData
- Returns:
- the external data of this component accessor.
-
putComponent
<T extends Component<ECS_TYPE>> void putComponent(@Nonnull Ref<ECS_TYPE> ref, @Nonnull ComponentType<ECS_TYPE, T> componentType, @Nonnull T component) Called to put the given component onto the given entity.- Type Parameters:
T- The component class type.- Parameters:
ref- The entity reference of the entity.componentType- The component type of the component being put.component- The component instance that is being put.
-
addComponent
<T extends Component<ECS_TYPE>> void addComponent(@Nonnull Ref<ECS_TYPE> ref, @Nonnull ComponentType<ECS_TYPE, T> componentType, @Nonnull T component) Adds the given component to the given entity reference.- Type Parameters:
T- The component class type.- Parameters:
ref- The entityRefthat we are adding this component to.componentType- The type of the component.component- The component instance to be added.
-
addComponent
<T extends Component<ECS_TYPE>> T addComponent(@Nonnull Ref<ECS_TYPE> ref, @Nonnull ComponentType<ECS_TYPE, T> componentType) Adds and returns the given component to the given entity reference.- Type Parameters:
T- The component class type.- Parameters:
ref- The entityRefthat we are adding this component to.componentType- The type of the component.- Returns:
- the newly instantiated instance of the component.
-
addEntities
Adds the given entities to the store of this component accessor.- Parameters:
holders- The holders of the entities to add.reason- The reason that we are adding these entities.- Returns:
- an array of entity
Refinstances, representing the added entities.
-
addEntity
Adds the given entity to the store of this component accessor.- Parameters:
holder- The holder of the entity to add.reason- The reason that we are adding this entity.- Returns:
- the entity
Refof the added entity.
-
removeEntity
@Nonnull Holder<ECS_TYPE> removeEntity(@Nonnull Ref<ECS_TYPE> ref, @Nonnull Holder<ECS_TYPE> holder, @Nonnull RemoveReason reason) Called to remove the given entity from the store of this component accessor.- Parameters:
ref- The entity reference of the entity being removed.holder- The holder of the entity being removed.reason- The reason that we are removing this entity.- Returns:
- the holder of the removed entity.
-
removeComponent
<T extends Component<ECS_TYPE>> void removeComponent(@Nonnull Ref<ECS_TYPE> ref, @Nonnull ComponentType<ECS_TYPE, T> componentType) Called to remove the component of the given type from the given entity.- Type Parameters:
T- The component type based on the store type.- Parameters:
ref- The entity reference of the entity that we are removing the component from.componentType- The component type of the component that we are removing.
-
tryRemoveComponent
<T extends Component<ECS_TYPE>> void tryRemoveComponent(@Nonnull Ref<ECS_TYPE> ref, @Nonnull ComponentType<ECS_TYPE, T> componentType) Called to try to remove the component og the given type from the given entity.- Type Parameters:
T- The component type based on the store type.- Parameters:
ref- The entity reference of the entity that we are removing the component from.componentType- The component type of the component that we are removing.
-
invoke
-
invoke
<Event extends EcsEvent> void invoke(@Nonnull EntityEventType<ECS_TYPE, Event> systemType, @Nonnull Ref<ECS_TYPE> ref, @Nonnull Event param) -
invoke
-
invoke
<Event extends EcsEvent> void invoke(@Nonnull EntityHolderEventType<ECS_TYPE, Event> systemType, @Nonnull Holder<ECS_TYPE> holder, @Nonnull Event param) -
invoke
-
invoke
<Event extends EcsEvent> void invoke(@Nonnull WorldEventType<ECS_TYPE, Event> systemType, @Nonnull Event param)
-