EntityProcessor Class
Namespace: Stride.EngineAssembly: Stride.Engine.dll
Entity processor, triggered on various EntityManager events such as Entity and Component additions and removals.
public abstract class EntityProcessor
| Name | Description | |
|---|---|---|
| Constructors | ||
| EntityProcessor(Type, Type[]) | Initializes a new instance of the EntityProcessor class. |
|
| Fields | ||
| DrawProfilingState | Draw Profiling state of this entity processor for the current frame. Pay attention this is a struct, use directly. Useful to add custom Mark events into processors |
|
| Tags | Tags associated to this entity processor |
|
| UpdateProfilingState | Update Profiling state of this entity processor for the current frame. Pay attention this is a struct, use directly. Useful to add custom Mark events into processors |
|
| Properties | ||
| Enabled | Gets or sets a value indicating whether this EntityProcessor is enabled. |
|
| EntityManager | Gets the current entity manager. |
|
| HasRequiredComponents | Gets a value indicating whether this processor is requiring some components to be present in addition to the main component of MainComponentType. |
|
| MainComponentType | Gets the primary component type handled by this processor |
|
| Order | Gets or sets the order of this processor. |
|
| RequiredTypes | Gets the required components for an entity to be added to this entity processor. |
|
| Services | Gets the services. |
|
| Methods | ||
| Draw(RenderContext) | Performs work related to this processor. |
|
| InternalAddEntity(Entity) | Adds the entity to the internal list of the EntityManager. Exposed for inheriting class that has no access to SceneInstance as internal. |
|
| InternalRemoveEntity(Entity, Boolean) | Removes the entity to the internal list of the EntityManager. Exposed for inheriting class that has no access to SceneInstance as internal. |
|
| 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. |
|
| Update(GameTime) | Performs work related to this processor. |
|
Constructors
EntityProcessor(Type, Type[])
Initializes a new instance of the EntityProcessor class.
protected EntityProcessor(Type mainComponentType, Type[] additionalTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | mainComponentType | Type of the main component. |
| System.Type[] | additionalTypes | The additional types required by this processor. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | If parameteters are null |
| System.ArgumentException | If a type does not inherit from EntityComponent |
Fields
DrawProfilingState
Draw Profiling state of this entity processor for the current frame. Pay attention this is a struct, use directly. Useful to add custom Mark events into processors
public ProfilingState DrawProfilingState
Field Value
| Type | Description |
|---|---|
| ProfilingState |
Tags
Tags associated to this entity processor
public PropertyContainer Tags
Field Value
| Type | Description |
|---|---|
| PropertyContainer |
UpdateProfilingState
Update Profiling state of this entity processor for the current frame. Pay attention this is a struct, use directly. Useful to add custom Mark events into processors
public ProfilingState UpdateProfilingState
Field Value
| Type | Description |
|---|---|
| ProfilingState |
Properties
Enabled
Gets or sets a value indicating whether this EntityProcessor is enabled.
public bool Enabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
EntityManager
Gets the current entity manager.
public EntityManager EntityManager { get; }
Property Value
| Type | Description |
|---|---|
| EntityManager |
HasRequiredComponents
Gets a value indicating whether this processor is requiring some components to be present in addition to the main component of MainComponentType.
public bool HasRequiredComponents { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
MainComponentType
Gets the primary component type handled by this processor
public Type MainComponentType { get; }
Property Value
| Type | Description |
|---|---|
| System.Type |
Order
Gets or sets the order of this processor.
public int Order { get; protected set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
RequiredTypes
Gets the required components for an entity to be added to this entity processor.
public TypeInfo[] RequiredTypes { get; }
Property Value
| Type | Description |
|---|---|
| System.Reflection.TypeInfo[] |
Services
Gets the services.
public IServiceRegistry Services { get; }
Property Value
| Type | Description |
|---|---|
| IServiceRegistry |
Methods
Draw(RenderContext)
Performs work related to this processor.
public virtual void Draw(RenderContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderContext | context |
InternalAddEntity(Entity)
Adds the entity to the internal list of the EntityManager. Exposed for inheriting class that has no access to SceneInstance as internal.
protected void InternalAddEntity(Entity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | entity | The entity. |
InternalRemoveEntity(Entity, Boolean)
Removes the entity to the internal list of the EntityManager. Exposed for inheriting class that has no access to SceneInstance as internal.
protected void InternalRemoveEntity(Entity entity, bool removeParent)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | entity | The entity. |
| System.Boolean | removeParent | Indicate if entity should be removed from its parent |
OnSystemAdd()
Run when this EntityProcessor is added to an EntityManager.
protected abstract void OnSystemAdd()
OnSystemRemove()
Run when this EntityProcessor is removed from an EntityManager.
protected abstract void OnSystemRemove()
ProcessEntityComponent(Entity, EntityComponent, Boolean)
Checks if Entity needs to be either added or removed.
protected abstract void ProcessEntityComponent(Entity entity, EntityComponent entityComponent, bool forceRemove)
Parameters
| Type | Name | Description |
|---|---|---|
| Entity | entity | The entity. |
| EntityComponent | entityComponent | |
| System.Boolean | forceRemove |
RemoveAllEntities()
Should be called prior removal, it will unregister all entities.
protected abstract void RemoveAllEntities()
Update(GameTime)
Performs work related to this processor.
public virtual void Update(GameTime time)
Parameters
| Type | Name | Description |
|---|---|---|
| GameTime | time |