System
A system update all eligible entities at a given frequency. This class is not meant to be used directly and should be sub-classed to define specific logic.
Table of Contents
- Methods
- Properties
Constructor
System
-
frequency=1
Parameters:
-
[frequency=1]Number optionalFrequency of execution.
Methods
dispose
()
dispose the system by exiting all the entities
enter
-
entity
Abstract method to subclass. Called when an entity is added to the system.
Parameters:
-
entityEntityThe added entity.
exit
-
entity
Abstract method to subclass. Called when an entity is removed from the system.
Parameters:
-
entityEntityThe removed entity.
postUpdate
()
Abstract method to subclass. Called once per update, after entities iteration.
preUpdate
()
Abstract method to subclass. Called once per update, before entities iteration.
test
-
entity
Abstract method to subclass. Should return true if the entity is eligible to the system, false otherwise.
Parameters:
-
entityEntityThe entity to test.
update
-
entity
Abstract method to subclass. Called for each entity to update. This is the only method that should actual mutate entity state.
Parameters:
-
entityEntityThe entity to update.
updateAll
()
Apply update to each entity of this system.
Properties
entities
ArrayEntity
Entities of the system.
frequency
Number
Frequency of update execution, a frequency of 1 run the system every
update, 2 will run the system every 2 updates, ect.