phaser/src/gameobjects/lights/LightsPlugin.js

51 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-02-12 16:01:20 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
2018-01-30 22:46:43 +00:00
var Class = require('../utils/Class');
var LightsManager = require('./LightsManager');
2018-02-12 22:16:27 +00:00
var PluginManager = require('../plugins/PluginManager');
2018-01-30 22:46:43 +00:00
var LightsPlugin = new Class({
Extends: LightsManager,
initialize:
function LightsPlugin (scene)
{
this.scene = scene;
this.systems = scene.sys;
if (!scene.sys.settings.isBooted)
{
scene.sys.events.once('boot', this.boot, this);
}
LightsManager.call(this);
},
boot: function ()
{
var eventEmitter = this.systems.events;
eventEmitter.on('shutdown', this.shutdown, this);
eventEmitter.on('destroy', this.destroy, this);
},
destroy: function ()
{
this.shutdown();
this.scene = undefined;
}
});
PluginManager.register('LightsPlugin', LightsPlugin, 'lights');
module.exports = LightsPlugin;