retro-engine / Exports / 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.
▪ Static currentScene: Scene
▸ Static addEntityToScene<T>(sceneName, entity, args?): void
Add an entity to a specified scene in the scene manager
| Name | Type |
|---|---|
T |
extends GameObjectBase<T> |
| 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[] |
[] |
- |
void
▸ Static addSystemToScene(sceneName, system, priority): void
Add a system to a specified scene in the scene manager
| 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 |
void
▸ Static getSceneNames(): string[]
Gets an array of loaded scene names
string[]
array of strings of scene names
▸ Static preLoadScene(scene_name): void
Pre-load the scene with the given name, so that it can be quickly switched to later
| Name | Type | Description |
|---|---|---|
scene_name |
string |
The name of the scene to load |
void
▸ Static switchToScene(scene_name, unload_current?): void
Switches the current scene to the scene with the given name
| 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 |
void
▸ Static unloadScene(scene_name): void
Unload the scene with the given name
| Name | Type | Description |
|---|---|---|
scene_name |
string |
name of the scene to unload |
void