Added game.add.plugin, a shotcut for game.plugins.add

This commit is contained in:
Alvin 2014-07-07 18:18:00 +02:00
parent 6ce183189f
commit f6f70d35a4

View file

@ -411,8 +411,25 @@ Phaser.GameObjectFactory.prototype = {
return filter;
},
/**
* Add a new Plugin into the PluginManager.
* The Plugin must have 2 properties: game and parent. Plugin.game is set to ths game reference the PluginManager uses, and parent is set to the PluginManager.
*
* @method Phaser.GameObjectFactory#plugin
* @param {object|Phaser.Plugin} plugin - The Plugin to add into the PluginManager. This can be a function or an existing object.
* @param {...*} parameter - Additional parameters that will be passed to the Plugin.init method.
* @return {Phaser.Plugin} The Plugin that was added to the manager.
*/
plugin: function (plugin) {
return this.game.plugins.add(plugin);
}
};
Phaser.GameObjectFactory.prototype.constructor = Phaser.GameObjectFactory;