class Entitas::Group(TEntity)

Included Modules

Defined in:

entitas.cr
entitas/group.cr

Constructors

Instance Method Summary

Instance methods inherited from module Entitas::Helper::Entities(TEntity)

count : Int32 count, each(&block : TEntity -> Nil) each, get_entities get_entities, has_entity?(entity : TEntity) : Bool has_entity?, size size, sort(&block : TEntity, TEntity -> U) : Array(TEntity) forall U sort

Instance methods inherited from module Entitas::IGroup

get_entities(buff : Enumerable(IEntity)) get_entities, get_single_entity : IEntity | Nil get_single_entity, handle_entity(entity : IEntity, index : Int32, component : Entitas::IComponent)
handle_entity(entity : IEntity) : Entitas::Events::GroupChanged
handle_entity
, handle_entity_silently(entity : IEntity) handle_entity_silently, on_entity_added(&block : Entitas::Events::OnEntityAdded -> Nil) on_entity_added, on_entity_added_event_hooks : Array(Proc(Entitas::Events::OnEntityAdded, Nil)) on_entity_added_event_hooks, on_entity_removed(&block : Entitas::Events::OnEntityRemoved -> Nil) on_entity_removed, on_entity_removed_event_hooks : Array(Proc(Entitas::Events::OnEntityRemoved, Nil)) on_entity_removed_event_hooks, on_entity_updated(&block : Entitas::Events::OnEntityUpdated -> Nil) on_entity_updated, on_entity_updated_event_hooks : Array(Proc(Entitas::Events::OnEntityUpdated, Nil)) on_entity_updated_event_hooks, receive_on_entity_added_event(event : Entitas::Events::OnEntityAdded) receive_on_entity_added_event, receive_on_entity_removed_event(event : Entitas::Events::OnEntityRemoved) receive_on_entity_removed_event, receive_on_entity_updated_event(event : Entitas::Events::OnEntityUpdated) receive_on_entity_updated_event, remove_all_event_handlers remove_all_event_handlers, remove_on_entity_added_hook(hook : Proc(Entitas::Events::OnEntityAdded, Nil)) remove_on_entity_added_hook, remove_on_entity_removed_hook(hook : Proc(Entitas::Events::OnEntityRemoved, Nil)) remove_on_entity_removed_hook, remove_on_entity_updated_hook(hook : Proc(Entitas::Events::OnEntityUpdated, Nil)) remove_on_entity_updated_hook, update_entity(entity : IEntity, index : Int32, prev_component : Entitas::IComponent | Nil, new_component : Entitas::IComponent | Nil) update_entity

Instance methods inherited from module Entitas::Helper::Entities(Entitas::IEntity)

count : Int32 count, each(&block : TEntity -> Nil) each, get_entities get_entities, has_entity?(entity : TEntity) : Bool has_entity?, size size, sort(&block : TEntity, TEntity -> U) : Array(TEntity) forall U sort

Constructor Detail

def self.new(matcher : Entitas::Matcher) #

[View source]

Instance Method Detail

def add_entity(entity : Entity, index : Int32, component : Component) #

[View source]
def add_entity_silently(entity : TEntity) : TEntity | Bool #

[View source]
def get_entities(buff : Enumerable(IEntity)) #

[View source]
def get_single_entity : Entitas::IEntity | Nil #

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.


[View source]
def handle_entity(entity : IEntity, index : Int32, component : Entitas::IComponent) #

This is used by the context to manage the group.


[View source]
def handle_entity(entity : IEntity) : Entitas::Events::GroupChanged #

[View source]
def handle_entity_silently(entity : IEntity) #

This is used by the context to manage the group.


[View source]
def remove_all_event_handlers #

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

Removes: OnEntityRemoved, OnEntityAdded, and OnEntityUpdated


[View source]
def remove_entity(entity : Entity, index : Int32, component : Component) : Entity | Nil #

[View source]
def remove_entity_silently(entity : Entity) : Entity | Nil #

[View source]
def to_json(json) #

[View source]
def to_s(io) #

[View source]
def update_entity(entity : IEntity, index : Int32, prev_component : Entitas::IComponent | Nil, new_component : Entitas::IComponent | Nil) #

This is used by the context to manage the group.


[View source]