class ECS::System
- ECS::System
- Reference
- Object
Overview
Сontainer for logic for processing filtered entities.
User systems should inherit from ECS::System
and implement #init
, #execute
, #teardown
, #filter
and #process
(in any combination. Just skip methods you don't need).
Direct Known Subclasses
Defined in:
myecs.crConstructors
-
.new(world : ECS::World)
Constructor.
Instance Method Summary
-
#active : Bool
Set
#active
property to false to temporarily disable system -
#active=(active : Bool)
Set
#active
property to false to temporarily disable system -
#execute
Will be called on each ECS::Systems.execute call
-
#filter(world : World) : Filter | Nil
Called once during ECS::Systems.init, after #init call.
-
#init
Will be called once during ECS::Systems.init call
-
#process(entity : Entity)
Called during each ECS::Systems.execute call, before #execute, for each entity that match the #filter
-
#teardown
Will be called once during ECS::Systems.teardown call
Constructor Detail
Instance Method Detail
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
Called during each ECS::Systems.execute call, before #execute, for each entity that match the #filter