mirror of
https://github.com/photonstorm/phaser
synced 2025-02-25 11:57:19 +00:00
Added new argument removeFromTilemap
This commit is contained in:
parent
d63321eba5
commit
0514d27efc
2 changed files with 18 additions and 4 deletions
|
@ -451,16 +451,23 @@ var DynamicTilemapLayer = new Class({
|
||||||
*
|
*
|
||||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#destroy
|
* @method Phaser.Tilemaps.DynamicTilemapLayer#destroy
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap?
|
||||||
*/
|
*/
|
||||||
destroy: function ()
|
destroy: function (removeFromTilemap)
|
||||||
{
|
{
|
||||||
|
if (removeFromTilemap === undefined) { removeFromTilemap = true; }
|
||||||
|
|
||||||
// Uninstall this layer only if it is still installed on the LayerData object
|
// Uninstall this layer only if it is still installed on the LayerData object
|
||||||
if (this.layer.tilemapLayer === this)
|
if (this.layer.tilemapLayer === this)
|
||||||
{
|
{
|
||||||
this.layer.tilemapLayer = undefined;
|
this.layer.tilemapLayer = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (removeFromTilemap)
|
||||||
|
{
|
||||||
this.tilemap.removeLayer(this);
|
this.tilemap.removeLayer(this);
|
||||||
|
}
|
||||||
|
|
||||||
this.tilemap = undefined;
|
this.tilemap = undefined;
|
||||||
this.layer = undefined;
|
this.layer = undefined;
|
||||||
|
|
|
@ -1439,16 +1439,23 @@ var StaticTilemapLayer = new Class({
|
||||||
*
|
*
|
||||||
* @method Phaser.Tilemaps.StaticTilemapLayer#destroy
|
* @method Phaser.Tilemaps.StaticTilemapLayer#destroy
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap?
|
||||||
*/
|
*/
|
||||||
destroy: function ()
|
destroy: function (removeFromTilemap)
|
||||||
{
|
{
|
||||||
|
if (removeFromTilemap === undefined) { removeFromTilemap = true; }
|
||||||
|
|
||||||
// Uninstall this layer only if it is still installed on the LayerData object
|
// Uninstall this layer only if it is still installed on the LayerData object
|
||||||
if (this.layer.tilemapLayer === this)
|
if (this.layer.tilemapLayer === this)
|
||||||
{
|
{
|
||||||
this.layer.tilemapLayer = undefined;
|
this.layer.tilemapLayer = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (removeFromTilemap)
|
||||||
|
{
|
||||||
this.tilemap.removeLayer(this);
|
this.tilemap.removeLayer(this);
|
||||||
|
}
|
||||||
|
|
||||||
this.tilemap = undefined;
|
this.tilemap = undefined;
|
||||||
this.layer = undefined;
|
this.layer = undefined;
|
||||||
|
|
Loading…
Add table
Reference in a new issue