![]() |
Entitas
0.35.0
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
|
Public Member Functions | |
delegate void | EntityChanged (Entity entity, int index, IComponent component) |
delegate void | ComponentReplaced (Entity entity, int index, IComponent previousComponent, IComponent newComponent) |
delegate void | EntityReleased (Entity entity) |
Entity (int totalComponents, Stack< IComponent >[] componentPools, PoolMetaData poolMetaData=null) | |
Entity | AddComponent (int index, IComponent component) |
Entity | RemoveComponent (int index) |
Entity | 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) |
Entity | Retain (object owner) |
void | Release (object owner) |
override string | ToString () |
Entity | ApplyBlueprint (Blueprint blueprint, bool replaceComponents=false) |
Public Attributes | |
readonly HashSet< object > | owners = new HashSet<object>() |
Returns all the objects that retain this entity. | |
Properties | |
int | totalComponents [get] |
The total amount of components an entity can possibly have. | |
int | creationIndex [get] |
bool | isEnabled [get] |
Stack< IComponent > [] | componentPools [get] |
PoolMetaData | poolMetaData [get] |
int | retainCount [get] |
Returns the number of objects that retain this entity. | |
Events | |
EntityChanged | OnComponentAdded |
EntityChanged | OnComponentRemoved |
ComponentReplaced | OnComponentReplaced |
EntityReleased | OnEntityReleased |
Use pool.CreateEntity() to create a new entity and pool.DestroyEntity() to destroy it. You can add, replace and remove IComponent to an entity.
|
inline |
|
inline |
Adds all components from the blueprint to the entity. When 'replaceComponents' is set to true entity.ReplaceComponent() will be used instead of entity.AddComponent().
Definition at line 10 of file BlueprintEntityExtension.cs.
|
inline |
|
inline |
|
inline |
|
inline |
Returns the componentPool for the specified component index. componentPools is set by the pool 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.
|
inline |
|
inline |
|
inline |
|
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.
|
inline |
|
inline |
|
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.
|
inline |
|
get |
componentPools is set by the pool 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 |
EntityChanged Entitas.Entity.OnComponentAdded |
EntityChanged Entitas.Entity.OnComponentRemoved |
ComponentReplaced Entitas.Entity.OnComponentReplaced |
EntityReleased Entitas.Entity.OnEntityReleased |