2017-02-23 03:10:48 +00:00
|
|
|
// bitmask flag for GameObject.renderMask
|
|
|
|
var _FLAG = 1; // 0001
|
|
|
|
|
2018-02-01 01:09:34 +00:00
|
|
|
/**
|
|
|
|
* Provides methods used for setting the visibility of a Game Object.
|
|
|
|
* Should be applied as a mixin and not used directly.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Components.Visible
|
|
|
|
* @mixin
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
|
|
|
|
2017-02-23 03:10:48 +00:00
|
|
|
var Visible = {
|
|
|
|
|
2017-02-24 01:45:15 +00:00
|
|
|
_visible: true,
|
|
|
|
|
2018-02-01 01:09:34 +00:00
|
|
|
/**
|
|
|
|
* The visible state of the Game Object.
|
|
|
|
*
|
|
|
|
* An invisible Game Object will skip rendering, but still process update logic.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Components.Visible#visible
|
|
|
|
* @type {boolean}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-02-23 03:10:48 +00:00
|
|
|
visible: {
|
|
|
|
|
|
|
|
get: function ()
|
|
|
|
{
|
2017-02-24 01:45:15 +00:00
|
|
|
return this._visible;
|
2017-02-23 03:10:48 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (value)
|
|
|
|
{
|
|
|
|
if (value)
|
|
|
|
{
|
2017-02-24 01:45:15 +00:00
|
|
|
this._visible = true;
|
2017-02-23 03:10:48 +00:00
|
|
|
this.renderFlags |= _FLAG;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-24 01:45:15 +00:00
|
|
|
this._visible = false;
|
2017-02-23 03:10:48 +00:00
|
|
|
this.renderFlags &= ~_FLAG;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-27 21:44:16 +00:00
|
|
|
},
|
|
|
|
|
2018-02-01 01:09:34 +00:00
|
|
|
/**
|
|
|
|
* Sets the visibility of this Game Object.
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Components.Visible.setVisible
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {boolean} value - The visible state of the Game Object.
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
|
|
|
|
*/
|
2017-06-27 21:44:16 +00:00
|
|
|
setVisible: function (value)
|
|
|
|
{
|
|
|
|
this.visible = value;
|
2017-02-23 03:10:48 +00:00
|
|
|
|
2017-06-27 21:44:16 +00:00
|
|
|
return this;
|
|
|
|
}
|
2017-02-23 03:10:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Visible;
|