EntityProcessor<TComponent, TData> Class
Namespace: Stride.EngineAssembly: Stride.Engine.dll
Helper class for EntityProcessor, that will keep track of Entity matching certain EntityComponent requirements.
public abstract class EntityProcessor<TComponent, TData> : EntityProcessor where TComponent : EntityComponent where TData : class
Type Parameters
Name | Description |
---|---|
TComponent | The main type of the component this processor is looking for. |
TData | The type of the associated data. |
Remarks
Additional precomputed data will be stored alongside the Entity to offer faster accesses and iterations.
Name | Description | |
---|---|---|
Constructors | ||
EntityProcessor(Type[]) | ||
Fields | ||
ComponentDatas | ||
Methods | ||
GenerateComponentData(Entity, TComponent) | Generates associated data to the given entity. |
|
IsAssociatedDataValid(Entity, TComponent, TData) | Checks if the current associated data is valid, or if readding the entity is required. |
|
OnEntityComponentAdding(Entity, TComponent, TData) | Run when a matching entity is added to this entity processor. |
|
OnEntityComponentRemoved(Entity, TComponent, TData) | Run when a matching entity is removed from this entity processor. |
|
OnSystemAdd() | Run when this EntityProcessor is added to an EntityManager. |
|
OnSystemRemove() | Run when this EntityProcessor is removed from an EntityManager. |
|
ProcessEntityComponent(Entity, EntityComponent, Boolean) | Checks if Entity needs to be either added or removed. |
|
RemoveAllEntities() | Should be called prior removal, it will unregister all entities. |
Constructors
EntityProcessor(Type[])
protected EntityProcessor(params Type[] requiredAdditionalTypes)
Parameters
Type | Name | Description |
---|---|---|
System.Type[] | requiredAdditionalTypes |
Fields
ComponentDatas
protected readonly Dictionary<TComponent, TData> ComponentDatas
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<TComponent, TData> |
Methods
GenerateComponentData(Entity, TComponent)
Generates associated data to the given entity.
protected abstract TData GenerateComponentData(Entity entity, TComponent component)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity. |
TComponent | component |
Returns
Type | Description |
---|---|
TData | The associated data. |
IsAssociatedDataValid(Entity, TComponent, TData)
Checks if the current associated data is valid, or if readding the entity is required.
protected virtual bool IsAssociatedDataValid(Entity entity, TComponent component, TData associatedData)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity. |
TComponent | component | |
TData | associatedData | The associated data. |
Returns
Type | Description |
---|---|
System.Boolean | True if the change in associated data requires the entity to be readded, false otherwise. |
OnEntityComponentAdding(Entity, TComponent, TData)
Run when a matching entity is added to this entity processor.
protected virtual void OnEntityComponentAdding(Entity entity, TComponent component, TData data)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity. |
TComponent | component | |
TData | data | The associated data. |
OnEntityComponentRemoved(Entity, TComponent, TData)
Run when a matching entity is removed from this entity processor.
protected virtual void OnEntityComponentRemoved(Entity entity, TComponent component, TData data)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity. |
TComponent | component | |
TData | data | The associated data. |
OnSystemAdd()
Run when this EntityProcessor is added to an EntityManager.
protected override void OnSystemAdd()
Overrides
OnSystemRemove()
Run when this EntityProcessor is removed from an EntityManager.
protected override void OnSystemRemove()
Overrides
ProcessEntityComponent(Entity, EntityComponent, Boolean)
Checks if Entity needs to be either added or removed.
protected override void ProcessEntityComponent(Entity entity, EntityComponent entityComponentArg, bool forceRemove)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity. |
EntityComponent | entityComponentArg | |
System.Boolean | forceRemove |
Overrides
RemoveAllEntities()
Should be called prior removal, it will unregister all entities.
protected override void RemoveAllEntities()