Class: System
System is one of the key elements of the Entity-Component-System architecture. A system is for implementing logic, manipulating entities and their components.
Hierarchy
-
↳ System
Table of contents
Constructors
Properties
Methods
Constructors
constructor
+ new System(messageBus
: IMessageBus, scene?
: IScene, subscriberID?
: number): System
Parameters:
Name | Type |
---|---|
messageBus |
IMessageBus |
scene? |
IScene |
subscriberID? |
number |
Returns: System
Inherited from: Subscriber
Properties
messageBus
• Protected
messageBus: IMessageBus
Reference to the message bus, the fundamental piece of JamJar for communicating with other parts of the engine.
scene
• Protected
Optional
scene: undefined | IScene
Any scene this system is part of, will change the lifecycle of the system to be part of the scene's lifecycle - it will be destroyed when the scene is destroyed.
subscriberID
• subscriberID: number
Inherited from: Subscriber.subscriberID
MESSAGE_UPDATE
▪ Readonly
Static
MESSAGE_UPDATE: system_update= "system_update"
Methods
Destroy
▸ Destroy(): void
Destroy destroys the System and unsubscribes it from all messages. The System should be garbage collected after this, unless a direct reference to it exists somewhere. Therefore direct references to systems are discouraged; communication should all be through the message bus.
Returns: void
OnDestroy
▸ Protected
OnDestroy(): void
Custom Destroy logic should go here to facilitate garbage collection, for example removing listeners.
Returns: void
OnMessage
▸ OnMessage(message
: IMessage): void
Parameters:
Name | Type |
---|---|
message |
IMessage |
Returns: void
Overrides: Subscriber
Update
▸ Protected
Update(dt
: number): void
General update method, default empty. Override with custom logic.
Parameters:
Name | Type | Description |
---|---|---|
dt |
number | DeltaTime |
Returns: void