From fd10e13238b7b434c6b96b3787abc8b62918c841 Mon Sep 17 00:00:00 2001 From: Christian Weimann Date: Sun, 12 Jan 2025 07:09:31 +0100 Subject: [PATCH] refactor(scene): extract scenes initialization into a separate method --- SceneMgr.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SceneMgr.js b/SceneMgr.js index 885975d..1971cd8 100644 --- a/SceneMgr.js +++ b/SceneMgr.js @@ -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;