From 444dda12d7f2c412427da9de87cb7ff5b986255e Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Fri, 11 May 2018 18:22:28 +0100 Subject: [PATCH] Added option to insert plugin into Scene immediately --- src/plugins/PluginManager.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/plugins/PluginManager.js b/src/plugins/PluginManager.js index dc656b7f0..56e0410fa 100644 --- a/src/plugins/PluginManager.js +++ b/src/plugins/PluginManager.js @@ -233,7 +233,7 @@ var PluginManager = new Class({ // key = Scene.Systems property key // plugin = code // mapping = Scene key - installScenePlugin: function (key, plugin, mapping) + installScenePlugin: function (key, plugin, mapping, addToScene) { if (typeof plugin !== 'function') { @@ -251,6 +251,20 @@ var PluginManager = new Class({ corePlugins[key] = { plugin: plugin, mapping: mapping, custom: true }; this.scenePlugins.push(key); + + if (addToScene) + { + var instance = new plugin(addToScene, this); + + addToScene.sys[key] = instance; + + if (mapping && mapping !== '') + { + addToScene[mapping] = instance; + } + + instance.boot(); + } }, /** @@ -393,20 +407,6 @@ var PluginManager = new Class({ } }, - setScenePlugin: function (scene) - { - }, - - addGameObject: function () - { - - }, - - addFileType: function () - { - - }, - /** * [description] *