class Entitas::Collector(TEntity)

Overview

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

Included Modules

Defined in:

entitas.cr
entitas/collector.cr

Constant Summary

Log = ::Log.for(self)

Constructors

Instance Method Summary

Instance methods inherited from module Entitas::ICollector

activate activate, deactivate deactivate

Constructor Detail

def self.new(group : Group(TEntity), group_event : Entitas::Events::GroupEvent) #

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


[View source]
def self.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.


[View source]

Instance Method Detail

def activate #

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


[View source]
def add_entity(event : Entitas::Events::OnEntityAdded) : Nil #

[View source]
def add_entity(event : Entitas::Events::OnEntityRemoved) : Nil #

[View source]
def add_entity(event : Entitas::Events::OnEntityUpdated) : Nil #

[View source]
def clear #

Clears all collected entities


[View source]
def deactivate #

[View source]
def each(&) #
Description copied from module Enumerable(TEntity)

Must yield this collection's elements to the block.


[View source]
def empty? #
Description copied from module Enumerable(TEntity)

Returns true if self is empty, false otherwise.

([] of Int32).empty? # => true
([1]).empty?         # => false

[View source]
def entities : Set(TEntity) #

def size #

Returns the total number of TEntity in this Collector


[View source]
def to_json(json : JSON::Builder) #

[View source]
def to_s(io) #

[View source]