class Entitas::Group(TEntity)
- Entitas::Group(TEntity)
- Reference
- Object
Included Modules
- Entitas::Helper::Entities(TEntity)
- Entitas::IGroup
- Enumerable(TEntity)
Defined in:
entitas.crentitas/group.cr
Constructors
Instance Method Summary
- #add_entity(entity : Entity, index : Int32, component : Component)
- #add_entity_silently(entity : TEntity) : TEntity | Bool
- #get_entities(buff : Enumerable(IEntity))
-
#get_single_entity : Entitas::IEntity | Nil
Returns the only entity in this group.
-
#handle_entity(entity : IEntity, index : Int32, component : Entitas::IComponent)
This is used by the context to manage the group.
- #handle_entity(entity : IEntity) : Entitas::Events::GroupChanged
-
#handle_entity_silently(entity : IEntity)
This is used by the context to manage the group.
-
#remove_all_event_handlers
Removes all event handlers from this group.
- #remove_entity(entity : Entity, index : Int32, component : Component) : Entity | Nil
- #remove_entity_silently(entity : Entity) : Entity | Nil
- #to_json(json)
- #to_s(io)
-
#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.
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
Instance Method Detail
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.
This is used by the context to manage the group.
This is used by the context to manage the group.
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
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.