Interface IEntityManager
Provides functionality for the creation, modification and destruction of entities.
public interface IEntityManager
Methods
AddComponent<T>(EntityId)
Adds a component of the specified type T to the specified entity.
T AddComponent<T>(EntityId entity) where T : Component
Parameters
entityEntityIdThe entity to add the component to.
Returns
- T
The created component.
Type Parameters
TThe type of the component to add.
AddComponent<T>(EntityId, EntityId)
Adds a component of the specified type T to the specified entity.
The entity is attached as a child to the specified parent.
T AddComponent<T>(EntityId entity, EntityId parent) where T : Component
Parameters
entityEntityIdThe entity to add the component to.
parentEntityIdThe parent of the entity to which the entity is to be attached.
Returns
- T
The created component.
Type Parameters
TThe type of the component to add.
AddComponent<T>(EntityId, EntityId, params object[])
Adds a component of the specified type T to the specified entity
with the specified constructor args. The entity is attached as a child to the specified
parent.
T AddComponent<T>(EntityId entity, EntityId parent, params object[] args) where T : Component
Parameters
entityEntityIdThe entity to add the component to.
parentEntityIdThe parent of the entity to which the entity is to be attached.
argsobject[]The arguments of the constructor of the component.
Returns
- T
The created component.
Type Parameters
TThe type of the component to add.
AddComponent<T>(EntityId, EntityId, T)
Adds a component of the specified type T to the specified entity.
The entity is attached as a child to the specified parent.
void AddComponent<T>(EntityId entity, EntityId parent, T component) where T : Component
Parameters
entityEntityIdThe entity to add the component to.
parentEntityIdThe parent of the entity to which the entity is to be attached.
componentTThe instance of the component to be added.
Type Parameters
TThe type of the component to add.
AddComponent<T>(EntityId, params object[])
Adds a component of the specified type T to the specified entity
with the specified constructor args.
T AddComponent<T>(EntityId entity, params object[] args) where T : Component
Parameters
entityEntityIdThe entity to add the component to.
argsobject[]The arguments of the constructor of the component.
Returns
- T
The created component.
Type Parameters
TThe type of the component to add.
AddComponent<T>(EntityId, T)
Adds a component of the specified type T to the specified entity.
void AddComponent<T>(EntityId entity, T component) where T : Component
Parameters
entityEntityIdThe entity to add the component to.
componentTThe instance of the component to be added.
Type Parameters
TThe type of the component to add.
Destroy(Component)
Destroys the specified component.
void Destroy(Component component)
Parameters
componentComponentThe component to destroy.
Destroy(EntityId)
Destroys the specified entity.
void Destroy(EntityId entity)
Parameters
entityEntityIdThe entity.
Destroy<T>(EntityId)
Destroys the components of the specified type T attached to the specified
entity.
void Destroy<T>(EntityId entity) where T : Component
Parameters
entityEntityIdThe entity of which to destroy its components of the specified type
T.
Type Parameters
TThe type of the components to destroy.
Exists(EntityId)
Returns a value indicating whether the specified entity exists.
bool Exists(EntityId entity)
Parameters
entityEntityIdThe entity to check its existence.
Returns
GetChildren(EntityId)
Gets the children of the specified entity.
EntityId[] GetChildren(EntityId entity)
Parameters
entityEntityIdThe entity to get the children of.
Returns
- EntityId[]
An array with the entities of which the parent is the specified
entity.
GetComponentInChildren<T>(EntityId)
Gets a component of the specified type T attached to a child entity of the specified
entity using a depth-first search.
T? GetComponentInChildren<T>(EntityId entity) where T : Component
Parameters
entityEntityIdThe entity to get the component from.
Returns
- T
The found component or null if no component of the specified type could be found.
Type Parameters
TThe type of the component to find.
GetComponentInParent<T>(EntityId)
Gets a component of the specified type T attached to a parent entity of the
specified entity.
T? GetComponentInParent<T>(EntityId entity) where T : Component
Parameters
entityEntityIdThe entity to get the component from.
Returns
- T
The found component or null if no component of the specified type could be found.
Type Parameters
TThe type of the component to find.
GetComponent<T>()
Gets a component of the specified type T attached to any entity.
T? GetComponent<T>() where T : Component
Returns
- T
The found component or null if no component of the specified type could be found.
Type Parameters
TThe type of the component to find.
GetComponent<T>(EntityId)
Gets a component of the specified type T attached to the specified entity.
T? GetComponent<T>(EntityId entity) where T : Component
Parameters
entityEntityIdThe entity to get the component from.
Returns
- T
The found component or null if no component of the specified type could be found.
Type Parameters
TThe type of the component to find.
GetComponentsInChildren<T>(EntityId)
Gets all components of the specified type T attached to a child entity of the
specified entity.
T[] GetComponentsInChildren<T>(EntityId entity) where T : Component
Parameters
entityEntityIdThe entity to get the components from.
Returns
- T[]
A collection of the found components.
Type Parameters
TThe type of the components to find.
GetComponentsInParent<T>(EntityId)
Gets all components of the specified type T attached to a parent entity of the
specified entity.
T[] GetComponentsInParent<T>(EntityId entity) where T : Component
Parameters
entityEntityIdThe entity to get the components from.
Returns
- T[]
A collection of the found components.
Type Parameters
TThe type of the components to find.
GetComponents<T>()
Gets all components of the specified type T attached to any entity.
T[] GetComponents<T>() where T : Component
Returns
- T[]
A collection of the found components.
Type Parameters
TThe type of the components to find.
GetComponents<T>(EntityId)
Gets all components of the specified type T attached to the specified entity.
T[] GetComponents<T>(EntityId entity) where T : Component
Parameters
entityEntityIdThe entity to get the components from.
Returns
- T[]
A collection of the found components.
Type Parameters
TThe type of the components to find.
GetParent(EntityId)
Gets the parent entity of the specified entity.
EntityId GetParent(EntityId entity)
Parameters
entityEntityIdThe entity to get its parent.
Returns
- EntityId
The parent entity of the specified
entity. Empty is returned if the specifiedentitydoes not have a parent.
GetRootEntities()
Gets all root entities with no parent.
EntityId[] GetRootEntities()
Returns
- EntityId[]
An array with all entities without a parent.