Skip to content

Latest commit

 

History

History
167 lines (96 loc) · 3.88 KB

File metadata and controls

167 lines (96 loc) · 3.88 KB

retro-engine / Exports / SceneManager

Class: SceneManager

Class that manages the scenes in the game. Can be used to switch between scenes, add entities and systems to scenes. It is also possible to pre-load scenes and prevent scenes from unloading, if you wish to quickly switch between them.

Table of contents

Properties

Methods

Properties

currentScene

Static currentScene: Scene

Defined in

src/sceneManager.ts:18

Methods

addEntityToScene

Static addEntityToScene<T>(sceneName, entity, args?): void

Add an entity to a specified scene in the scene manager

Type parameters

Name Type
T extends GameObjectBase<T>

Parameters

Name Type Default value Description
sceneName string undefined name of scene to which entity is to be added
entity T undefined entity obect to be added
args any[] [] -

Returns

void

Defined in

src/sceneManager.ts:193


addSystemToScene

Static addSystemToScene(sceneName, system, priority): void

Add a system to a specified scene in the scene manager

Parameters

Name Type Description
sceneName string name of scene to which system is to be added
system System system object to be added
priority number priority of system to be added

Returns

void

Defined in

src/sceneManager.ts:204


getSceneNames

Static getSceneNames(): string[]

Gets an array of loaded scene names

Returns

string[]

array of strings of scene names

Defined in

src/sceneManager.ts:31


preLoadScene

Static preLoadScene(scene_name): void

Pre-load the scene with the given name, so that it can be quickly switched to later

Parameters

Name Type Description
scene_name string The name of the scene to load

Returns

void

Defined in

src/sceneManager.ts:74


switchToScene

Static switchToScene(scene_name, unload_current?): void

Switches the current scene to the scene with the given name

Parameters

Name Type Default value Description
scene_name string undefined The name of the scene to switch to
unload_current boolean true Whether to unload the current scene

Returns

void

Defined in

src/sceneManager.ts:42


unloadScene

Static unloadScene(scene_name): void

Unload the scene with the given name

Parameters

Name Type Description
scene_name string name of the scene to unload

Returns

void

Defined in

src/sceneManager.ts:99