Skip to content

Class: Scene

Scene is a way to categorise entities, components and systems together, allowing them to be loaded/deleted together.

Hierarchy

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

+ new Scene(messageBus: IMessageBus, entities?: IEntity[]): Scene

Parameters:

Name Type
messageBus IMessageBus
entities IEntity[]

Returns: Scene

Inherited from: Subscriber

Properties

id

id: number

Implementation of: IScene.id


messageBus

Protected messageBus: IMessageBus


subscriberID

subscriberID: number

Inherited from: Subscriber.subscriberID


MESSAGE_DESTROY

Readonly Static MESSAGE_DESTROY: scene_destroy= "scene_destroy"


MESSAGE_ON_START

Readonly Static MESSAGE_ON_START: scene_on_start= "scene_on_start"

Methods

AddEntity

AddEntity(entity: IEntity): void

Parameters:

Name Type
entity IEntity

Returns: void


Destroy

Destroy(): void

Destroy destroys the scene, alongside all linked entities, components and systems.

Returns: void


OnMessage

OnMessage(message: IMessage): void

Parameters:

Name Type
message IMessage

Returns: void

Overrides: Subscriber


OnStart

ProtectedOnStart(): void

OnStart is triggered on scene start.

Returns: void


Start

Start(): void

Start starts this scene

Returns: void