zerk.game.engine.system Class
System
Base class for systems. All systems should inherit from here.
Item Index
Methods
Methods
_getConfigDefaults
()
Object
protected
Returns the configuration defaults of the system
Returns:
_getSystem
-
name
Returns system by given name
This method is used to communicate with other systems.
Parameters:
-
name
StringSystem name
Returns:
_log
-
message
-
severity
Local log method
Parameters:
-
message
StringLog message
-
severity
IntegerLog severity
fireEvent
-
event
Fire event
Parameters:
-
event
StringEvent name
Returns:
getName
()
String
Returns the name of the system
Returns:
getPriority
()
Integer
Returns the priority of the system
Returns:
getThread
()
String
Returns the thread the systems runs in
Returns:
init
-
engine
-
config
Class constructor
Parameters:
-
engine
zerk.game.engineEngine instance
-
config
ObjectSystem configuration
on
-
event
-
callback
-
scope
Register event handler
Parameters:
-
event
StringEvent name
-
callback
FunctionCallback function. Return false to cancel event bubble.
-
scope
ObjectScope to be used in callback function
removeEntity
-
entity
Removes an entity from the system
Parameters:
-
entity
config.entityEntity state
start
()
Starts the system
stop
()
Stops the system
un
-
event
-
callback
Unregister event handler
Parameters:
-
event
StringEvent name
-
callback
FunctionCallback function
Returns:
update
()
Updates the system
Fired every tick.
useComponent
-
name
Returns true when the system is interested in given component
This method is used by the engine to decide whether entities containing this component should be added to the system.
Parameters:
-
name
StringComponent name
Returns:
Properties
_config
Object
protected
System configuration
_entities
Array
protected
Entities register
Entities that this system is interested in.
_eventListeners
Array
protected
List of event handlers
_name
String
protected
Name of the system
_priority
Integer
protected
Priority of this system
Priorities handle the order in which systems are processed.
_thread
String
protected
Thread that runs this system
Can be:
- simulation
- render
- none