class

Entitas::Collector(TEntity)

Inherits Enumerable / Entitas::ICollector / Reference / Object

A Collector can observe one or more groups from the same context and collects changed entities based on the specified groupEvent.

Constants

Log = ::Log.for(self)

Constructors

new(group : Group(TEntity), group_event : Entitas::Events::GroupEvent)

Creates a Collector and will collect changed entities based on the specified group_event.

Source
new(groups : Array(Group(TEntity)), group_events : Array(Entitas::Events::GroupEvent))

Creates a Collector and will collect changed entities based on the specified group_events.

Source

Instance methods

activate

Activates the Collector and will start collecting changed entities. Collectors are activated by default.

Source
add_entity(event : Entitas::Events::OnEntityAdded) : Nil
Source
add_entity(event : Entitas::Events::OnEntityRemoved) : Nil
Source
add_entity(event : Entitas::Events::OnEntityUpdated) : Nil
Source
clear

Clears all collected entities

Source
deactivate
Source
each

Must yield this collection's elements to the block.

Source
empty?

Returns true if self does not contain any element.

([] of Int32).empty? # => true
([1]).empty?         # => false
[nil, false].empty?  # => false
  • #present? returns the inverse.
Source
entities
size

Returns the total number of TEntity in this Collector

Source
to_json(json : JSON::Builder)
Source
to_s(io)
Source

Nested types