![]() |
Entitas
0.40.0
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
|
Public Member Functions | |
Context (int totalComponents) | |
Context (int totalComponents, int startCreationIndex, ContextInfo contextInfo) | |
TEntity | CreateEntity () |
void | DestroyEntity (TEntity entity) |
void | DestroyAllEntities () |
bool | HasEntity (TEntity entity) |
Determines whether the context has the specified entity. | |
TEntity [] | GetEntities () |
Returns all entities which are currently in the context. | |
IGroup< TEntity > | GetGroup (IMatcher< TEntity > matcher) |
void | ClearGroups () |
void | AddEntityIndex (IEntityIndex entityIndex) |
IEntityIndex | GetEntityIndex (string name) |
Gets the IEntityIndex for the specified name. | |
void | DeactivateAndRemoveEntityIndices () |
Deactivates and removes all entity indices. | |
void | ResetCreationIndex () |
Resets the creationIndex back to 0. | |
void | ClearComponentPool (int index) |
Clears the componentPool at the specified index. | |
void | ClearComponentPools () |
Clears all componentPools. | |
void | Reset () |
override string | ToString () |
Properties | |
int | totalComponents [get] |
Stack< IComponent > [] | componentPools [get] |
ContextInfo | contextInfo [get] |
int | count [get] |
Returns the number of entities in the context. | |
int | reusableEntitiesCount [get] |
int | retainedEntitiesCount [get] |
Events | |
ContextEntityChanged | OnEntityCreated |
Occurs when an entity gets created. | |
ContextEntityChanged | OnEntityWillBeDestroyed |
Occurs when an entity will be destroyed. | |
ContextEntityChanged | OnEntityDestroyed |
Occurs when an entity got destroyed. | |
ContextGroupChanged | OnGroupCreated |
Occurs when a group gets created for the first time. | |
ContextGroupChanged | OnGroupCleared |
Occurs when a group gets cleared. | |
A context manages the lifecycle of entities and groups. You can create and destroy entities and get groups of entities. The prefered way to create a context is to use the generated methods from the code generator, e.g. var context = new GameContext();
TEntity | : | class | |
TEntity | : | IEntity | |
TEntity | : | new() |
Definition at line 9 of file Context.cs.
|
inline |
The prefered way to create a context is to use the generated methods from the code generator, e.g. var context = new GameContext();
Definition at line 79 of file Context.cs.
|
inline |
The prefered way to create a context is to use the generated methods from the code generator, e.g. var context = new GameContext();
Definition at line 84 of file Context.cs.
|
inline |
Adds the IEntityIndex for the specified name. There can only be one IEntityIndex per name.
Definition at line 266 of file Context.cs.
|
inline |
Clears all groups. This is useful when you want to soft-restart your application.
Definition at line 245 of file Context.cs.
|
inline |
Creates a new entity or gets a reusable entity from the internal ObjectPool for entities.
Definition at line 123 of file Context.cs.
|
inline |
Destroys all entities in the context. Throws an exception if there are still retained entities.
Definition at line 186 of file Context.cs.
|
inline |
Destroys the entity, removes all its components and pushs it back to the internal ObjectPool for entities.
Definition at line 151 of file Context.cs.
|
inline |
Returns a group for the specified matcher. Calling context.GetGroup(matcher) with the same matcher will always return the same instance of the group.
Definition at line 217 of file Context.cs.
|
inline |
Resets the context (destroys all entities and resets creationIndex back to 0).
Definition at line 315 of file Context.cs.
|
get |
Returns all componentPools. componentPools is used to reuse removed components. Removed components will be pushed to the componentPool. Use entity.CreateComponent(index, type) to get a new or reusable component from the componentPool.
Definition at line 36 of file Context.cs.
|
get |
The contextInfo contains information about the context. It's used to provide better error messages.
Definition at line 40 of file Context.cs.
|
get |
Returns the number of entities that are currently retained by other objects (e.g. Group, Collector, ReactiveSystem).
Definition at line 51 of file Context.cs.
|
get |
Returns the number of entities in the internal ObjectPool for entities which can be reused.
Definition at line 47 of file Context.cs.
|
get |
The total amount of components an entity can possibly have. This value is generated by the code generator, e.g ComponentLookup.TotalComponents.
Definition at line 29 of file Context.cs.