phaser/3.0.0/merge/gameobjects/container/Container.js

33 lines
907 B
JavaScript
Raw Normal View History

2016-10-08 16:19:55 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2016 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
Phaser.GameObject.Container = function (state, parent, x, y, name)
{
Phaser.GameObject.call(this, state, x, y, null, null, parent);
2016-10-08 16:19:55 +00:00
/**
* @property {number} type - The const type of this object.
* @readonly
*/
this.type = Phaser.CONTAINER;
this.name = name;
2016-10-08 16:19:55 +00:00
this.children = new Phaser.Component.Children(this);
2016-10-08 16:19:55 +00:00
};
Phaser.GameObject.Container.prototype = Object.create(Phaser.GameObject.prototype);
Phaser.GameObject.Container.prototype.constructor = Phaser.GameObject.Container;
2016-10-08 16:19:55 +00:00
Phaser.GameObject.Container.prototype.preUpdate = function ()
{
2016-10-14 05:31:01 +00:00
if (this.parent)
{
this.color.worldAlpha = this.parent.color.worldAlpha;
2016-10-14 05:31:01 +00:00
}
2016-10-08 16:19:55 +00:00
this.children.preUpdate();
2016-10-08 16:19:55 +00:00
};