class

ECS::System

Inherits Reference / Object

Сontainer for logic for processing filtered entities. User systems should inherit from ECS::System and implement init, execute, teardown, filter, preprocess and process (in any combination. Just skip methods you don't need).

Constructors

new(world : ECS::World)

Constructor. Called before init

Source

Instance methods

active

Set active property to false to temporarily disable system

Source
active=(active : Bool)

Set active property to false to temporarily disable system

Source
execute

Will be called on each ECS::Systems.execute call

Source
filter(world : World) : Filter | Nil

Called once during ECS::Systems.init, after #init call. If this method is present, it should return a filter that will be applied to a world It can also return nil that means that no filter is present and #process won't be called Example:

def filter(world : World)
  world.of(Component1)
end
Source
init

Will be called once during ECS::Systems.init call

Source
preprocess

Will be called on each ECS::Systems.execute call, before #process and #execute

Source
process(entity : Entity)

Called during each ECS::Systems.execute call, before #execute, for each entity that match the #filter

Source
teardown

Will be called once during ECS::Systems.teardown call

Source