Added option to insert plugin into Scene immediately

This commit is contained in:
Richard Davey 2018-05-11 18:22:28 +01:00
parent 271c0a08b8
commit 444dda12d7

View file

@ -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]
*