Table of Contents

Class EntityProcessor<TComponent, TData>

Namespace
Stride.Engine
Assembly
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

TComponent

The main type of the component this processor is looking for.

TData

The type of the associated data.

Inheritance
EntityProcessor<TComponent, TData>
Derived
Inherited Members

Remarks

Additional precomputed data will be stored alongside the Entity to offer faster accesses and iterations.

Constructors

EntityProcessor(params Type[])

protected EntityProcessor(params Type[] requiredAdditionalTypes)

Parameters

requiredAdditionalTypes Type[]

Fields

ComponentDatas

protected readonly Dictionary<TComponent, TData> ComponentDatas

Field Value

Dictionary<TComponent, TData>

Methods

GenerateComponentData(Entity, TComponent)

Generates associated data to the given entity.

protected abstract TData GenerateComponentData(Entity entity, TComponent component)

Parameters

entity Entity

The entity.

component TComponent

Returns

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

entity Entity

The entity.

component TComponent
associatedData TData

The associated data.

Returns

bool

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

entity Entity

The entity.

component TComponent
data TData

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

entity Entity

The entity.

component TComponent
data TData

The associated data.

OnSystemAdd()

Run when this EntityProcessor is added to an EntityManager.

protected override void OnSystemAdd()

OnSystemRemove()

Run when this EntityProcessor is removed from an EntityManager.

protected override void OnSystemRemove()

ProcessEntityComponent(Entity, EntityComponent, bool)

Checks if Entity needs to be either added or removed.

protected override void ProcessEntityComponent(Entity entity, EntityComponent entityComponentArg, bool forceRemove)

Parameters

entity Entity

The entity.

entityComponentArg EntityComponent
forceRemove bool

RemoveAllEntities()

Should be called prior removal, it will unregister all entities.

protected override void RemoveAllEntities()