Click or drag to resize
EntityManager Class
Creates and removes game entities. Holds references to all component managers, delegating all calls for adding or removing components.
Inheritance Hierarchy
SystemObject
  Slash.ECS.ComponentsEntityManager

Namespace: Slash.ECS.Components
Assembly: Slash.ECS (in Slash.ECS.dll) Version: 1.0.6018.40178
Syntax
public class EntityManager

The EntityManager type exposes the following members.

Constructors
  NameDescription
Public methodEntityManager
Constructs a new entity manager without any initial entities.
Top
Properties
  NameDescription
Public propertyEntities
Read-only collection of all entities.
Public propertyEntityCount
Total number of entities managed by this EntityManager instance.
Top
Methods
  NameDescription
Public methodActivateEntity
Re-activates the entity with the specified id, if it is inactive.
Public methodAddComponent(Int32, IEntityComponent)
Attaches the passed component to the entity with the specified id.
Public methodAddComponent(Int32, IEntityComponent, Boolean)
Attaches the passed component to the entity with the specified id.
Public methodAddComponent(Type, Int32, IAttributeTable)
Adds a component with the specified type to entity with the specified id and initializes it with the values taken from the passed attribute table.
Public methodAddComponentT(Int32)
Attaches a new component of the passed type to the entity with the specified id.
Public methodCleanUpEntities
Removes all entities that have been issued for removal during the current tick, detaching all components.
Public methodComponentsOfType
Returns an iterator over all components of the specified type.
Public methodCreateEntity
Creates a new entity.
Public methodCreateEntity(Int32)
Creates a new entity with the specified id.
Public methodDeactivateEntity
De-activates the entity with the specified id. Inactive entities are considered as removed, until they are re-activated again.
Public methodEntitiesWithComponent
Returns an iterator over all entities having components of the specified type attached.
Public methodEntityIsAlive
Checks whether the entity with the passed id has been removed or not.
Public methodEntityIsBeingRemoved
Checks if the entity with the specified id will be removed this frame.
Public methodEntityIsInactive
Checks whether the entity with the specified id is inactive.
Public methodGetComponent(Int32, Type, Boolean)
Gets a component of the passed type attached to the entity with the specified id.
Public methodGetComponentT(Int32)
Gets a component of the passed type attached to the entity with the specified id.
Public methodGetComponents
Returns all components of the entity with the specified id.
Public methodGetEntities
Retrieves an array containing the ids of all living entities in O(n).
Public methodGetEntities(FuncInt32, Boolean)
Returns the entity ids of all entities which fulfill the specified predicate.
Public methodGetEntityComponentTComponent
Convenience method for retrieving a component from two possible entities.
Public methodGetEntityComponentsTComponentTypeA, TComponentTypeB
Convenience method for retrieving components from two entities in case the order of the entities is unknown.
Public methodInitEntity
Initializes the specified entity, adding the specified components.
Public methodOnEntityInitialized
Called when the entity with the specified id was initialized. TODO(co): This shouldn't be public.
Public methodRegisterComponentListeners(Type, ComponentAddedDelegateObject, ComponentRemovedDelegateObject)
Registers listeners to track adding/removing of components of specified component type.
Public methodRegisterComponentListenersT(ComponentAddedDelegateT, ComponentRemovedDelegateT)
Registers listeners to track adding/removing of components of type T.
Public methodRemoveComponent
Removes a component of the passed type from the entity with the specified id.
Public methodRemoveEntities
Removes all entities.
Public methodRemoveEntity

Issues the entity with the specified id for removal at the end of the current tick.

If the entity is inactive, it is removed immediately and no further event is raised.

Public methodTryGetComponent(Int32, Type, IEntityComponent)
Tries to get a component of the passed type attached to the entity with the specified id.
Public methodTryGetComponentT(Int32, T)
Tries to get a component of the passed type attached to the entity with the specified id.
Top
Events
  NameDescription
Public eventEntityInitialized
Entity has been created and all components have been added and initialized.
Public eventEntityRemoved
Entity and all of its components will be removed at the end of this tick.
Top
Extension Methods
  NameDescription
Public Extension MethodCreateEntity
Creates a new entity, adding components matching the passed blueprint and initializing these with the data stored in the blueprint and the specified configuration. Configuration data is preferred over blueprint data.
(Defined by EntityManagerExtensions.)
Public Extension MethodInitEntity
Initializes the specified entity, adding components matching the passed blueprint and initializing these with the data stored in the blueprint and the specified configuration. Configuration data is preferred over blueprint data.
(Defined by EntityManagerExtensions.)
Top
See Also