Entitas  1.13.0
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
Entitas.Group< TEntity > Class Template Reference
Inheritance diagram for Entitas.Group< TEntity >:
Entitas.IGroup< TEntity >

Public Member Functions

 Group (IMatcher< TEntity > matcher)
 
void HandleEntitySilently (TEntity entity)
 This is used by the context to manage the group.
 
void HandleEntity (TEntity entity, int index, IComponent component)
 This is used by the context to manage the group.
 
void UpdateEntity (TEntity entity, int index, IComponent previousComponent, IComponent newComponent)
 This is used by the context to manage the group.
 
void RemoveAllEventHandlers ()
 
GroupChanged< TEntity > HandleEntity (TEntity entity)
 
bool ContainsEntity (TEntity entity)
 Determines whether this group has the specified entity.
 
TEntity [] GetEntities ()
 Returns all entities which are currently in this group.
 
List< TEntity > GetEntities (List< TEntity > buffer)
 Fills the buffer with all entities which are currently in this group.
 
IEnumerable< TEntity > AsEnumerable ()
 
HashSet< TEntity >.Enumerator GetEnumerator ()
 
TEntity GetSingleEntity ()
 
override string ToString ()
 

Properties

int count [get]
 Returns the number of entities in the group.
 
IMatcher< TEntity > matcher [get]
 Returns the matcher which was used to create this group.
 

Events

GroupChanged< TEntity > OnEntityAdded
 Occurs when an entity gets added.
 
GroupChanged< TEntity > OnEntityRemoved
 Occurs when an entity gets removed.
 
GroupUpdated< TEntity > OnEntityUpdated
 Occurs when a component of an entity in the group gets replaced.
 

Detailed Description

Use context.GetGroup(matcher) to get a group of entities which match the specified matcher. Calling context.GetGroup(matcher) with the same matcher will always return the same instance of the group. The created group is managed by the context and will always be up to date. It will automatically add entities that match the matcher or remove entities as soon as they don't match the matcher anymore.

Type Constraints
TEntity :class 
TEntity :IEntity 

Definition at line 11 of file Group.cs.

Constructor & Destructor Documentation

◆ Group()

Entitas.Group< TEntity >.Group ( IMatcher< TEntity >  matcher)
inline

Use context.GetGroup(matcher) to get a group of entities which match the specified matcher.

Definition at line 40 of file Group.cs.

Member Function Documentation

◆ GetSingleEntity()

TEntity Entitas.Group< TEntity >.GetSingleEntity ( )
inline

Returns the only entity in this group. It will return null if the group is empty. It will throw an exception if the group has more than one entity.

Definition at line 171 of file Group.cs.

◆ RemoveAllEventHandlers()

void Entitas.Group< TEntity >.RemoveAllEventHandlers ( )
inline

Removes all event handlers from this group. Keep in mind that this will break reactive systems and entity indices which rely on this group.

Definition at line 82 of file Group.cs.


The documentation for this class was generated from the following file: