Entitas-0.32.0
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)
 Use pool.GetGroup(matcher) to get a group of entities which match the specified 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.

Member Function Documentation

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.

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.


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