refactor(scene): extract scenes initialization into a separate method
This commit is contained in:
@@ -16,9 +16,16 @@ const tm = new TimerMgr();
|
||||
class SceneMgr {
|
||||
|
||||
constructor() {
|
||||
// Log the initialization message for Scene Manager.
|
||||
log.info('Initialization of SceneMgr');
|
||||
|
||||
this.scenes = this.getScenes().reduce((scenes, scene) => {
|
||||
// Initialize the scenes map by reducing the array of scenes into an object with unique IDs as keys.
|
||||
this.scenes = this.initializeScenes();
|
||||
}
|
||||
|
||||
// Helper method to initialize scenes using reduce.
|
||||
initializeScenes() {
|
||||
return this.getScenes().reduce((scenes, scene) => {
|
||||
const sceneUID = scene.getUID();
|
||||
scenes[sceneUID] = new Scene(scene);
|
||||
return scenes;
|
||||
|
||||
Reference in New Issue
Block a user