Entitas  0.35.0
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
Public Member Functions | Properties | Events | List of all members
Entitas.Group Class Reference

Public Member Functions

delegate void GroupChanged (Group group, Entity entity, int index, IComponent component)
 
delegate void GroupUpdated (Group group, Entity entity, int index, IComponent previousComponent, IComponent newComponent)
 
 Group (IMatcher matcher)
 
void HandleEntitySilently (Entity entity)
 This is used by the pool to manage the group.
 
void HandleEntity (Entity entity, int index, IComponent component)
 This is used by the pool to manage the group.
 
void UpdateEntity (Entity entity, int index, IComponent previousComponent, IComponent newComponent)
 This is used by the pool to manage the group.
 
void RemoveAllEventHandlers ()
 
bool ContainsEntity (Entity entity)
 Determines whether this group has the specified entity.
 
Entity [] GetEntities ()
 Returns all entities which are currently in this group.
 
Entity GetSingleEntity ()
 
override string ToString ()
 

Properties

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

Events

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

Detailed Description

Use pool.GetGroup(matcher) to get a group of entities which match the specified matcher. Calling pool.GetGroup(matcher) with the same matcher will always return the same instance of the group. The created group is managed by the pool 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.

Definition at line 18 of file Group.cs.

Constructor & Destructor Documentation

§ Group()

Entitas.Group.Group ( IMatcher  matcher)
inline

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

Definition at line 56 of file Group.cs.

Member Function Documentation

§ GetSingleEntity()

Entity Entitas.Group.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 177 of file Group.cs.

§ RemoveAllEventHandlers()

void Entitas.Group.RemoveAllEventHandlers ( )
inline

This is called by pool.Reset() and pool.ClearGroups() to remove all event handlers. This is useful when you want to soft-restart your application.

Definition at line 103 of file Group.cs.


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