![]() |
Entitas
0.40.0
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
|
Public Member Functions | |
void | Initialize (int creationIndex, int totalComponents, Stack< IComponent >[] componentPools, ContextInfo contextInfo=null) |
void | Reactivate (int creationIndex) |
void | AddComponent (int index, IComponent component) |
void | RemoveComponent (int index) |
void | ReplaceComponent (int index, IComponent component) |
IComponent | GetComponent (int index) |
IComponent [] | GetComponents () |
Returns all added components. | |
int [] | GetComponentIndices () |
Returns all indices of added components. | |
bool | HasComponent (int index) |
bool | HasComponents (int[] indices) |
bool | HasAnyComponent (int[] indices) |
void | RemoveAllComponents () |
Removes all components. | |
Stack< IComponent > | GetComponentPool (int index) |
IComponent | CreateComponent (int index, Type type) |
T | CreateComponent< T > (int index) |
void | Retain (object owner) |
void | Release (object owner) |
void | Destroy () |
void | RemoveAllOnEntityReleasedHandlers () |
override string | ToString () |
Properties | |
int | totalComponents [get] |
The total amount of components an entity can possibly have. | |
int | creationIndex [get] |
bool | isEnabled [get] |
Stack< IComponent > [] | componentPools [get] |
ContextInfo | contextInfo [get] |
int | retainCount [get] |
Returns the number of objects that retain this entity. | |
HashSet< object > | owners [get] |
Returns all the objects that retain this entity. | |
![]() | |
int | totalComponents [get] |
int | creationIndex [get] |
bool | isEnabled [get] |
Stack< IComponent > [] | componentPools [get] |
ContextInfo | contextInfo [get] |
HashSet< object > | owners [get] |
int | retainCount [get] |
Events | |
EntityComponentChanged | OnComponentAdded |
EntityComponentChanged | OnComponentRemoved |
EntityComponentReplaced | OnComponentReplaced |
EntityReleased | OnEntityReleased |
![]() | |
EntityComponentChanged | OnComponentAdded |
EntityComponentChanged | OnComponentRemoved |
EntityComponentReplaced | OnComponentReplaced |
EntityReleased | OnEntityReleased |
Use context.CreateEntity() to create a new entity and context.DestroyEntity() to destroy it. You can add, replace and remove IComponent to an entity.
|
inline |
Adds a component at the specified index. You can only have one component at an index. Each component type must have its own constant index. The prefered way is to use the generated methods from the code generator.
Implements Entitas.IEntity.
|
inline |
Returns a new or reusable component from the componentPool for the specified component index.
Implements Entitas.IEntity.
|
inline |
Returns a new or reusable component from the componentPool for the specified component index.
Implements Entitas.IEntity.
T | : | new() |
|
inline |
Returns a component at the specified index. You can only get a component at an index if it exists. The prefered way is to use the generated methods from the code generator.
Implements Entitas.IEntity.
|
inline |
Returns the componentPool for the specified component index. componentPools is set by the context which created the entity and 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.
Implements Entitas.IEntity.
|
inline |
Determines whether this entity has a component at any of the specified indices.
Implements Entitas.IEntity.
|
inline |
Determines whether this entity has a component at the specified index.
Implements Entitas.IEntity.
|
inline |
Determines whether this entity has components at all the specified indices.
Implements Entitas.IEntity.
|
inline |
Releases the entity. An owner can only release an entity if it retains it. Retain/Release is part of AERC (Automatic Entity Reference Counting) and is used internally to prevent pooling retained entities. If you use retain manually you also have to release it manually at some point.
Implements Entitas.IEntity.
|
inline |
Removes a component at the specified index. You can only remove a component at an index if it exists. The prefered way is to use the generated methods from the code generator.
Implements Entitas.IEntity.
|
inline |
Replaces an existing component at the specified index or adds it if it doesn't exist yet. The prefered way is to use the generated methods from the code generator.
Implements Entitas.IEntity.
|
inline |
Retains the entity. An owner can only retain the same entity once. Retain/Release is part of AERC (Automatic Entity Reference Counting) and is used internally to prevent pooling retained entities. If you use retain manually you also have to release it manually at some point.
Implements Entitas.IEntity.
|
inline |
|
get |
componentPools is set by the context which created the entity and 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. Use entity.GetComponentPool(index) to get a componentPool for a specific component index.
|
get |
|
get |
|
get |
EntityComponentChanged Entitas.Entity.OnComponentAdded |
EntityComponentChanged Entitas.Entity.OnComponentRemoved |
EntityComponentReplaced Entitas.Entity.OnComponentReplaced |
EntityReleased Entitas.Entity.OnEntityReleased |