diff --git a/src/objects/room/parts/Stair.ts b/src/objects/room/parts/Stair.ts index 38ced2de..a8ab36ca 100644 --- a/src/objects/room/parts/Stair.ts +++ b/src/objects/room/parts/Stair.ts @@ -142,6 +142,7 @@ export class Stair extends PIXI.Container implements IRoomPart { destroy() { super.destroy(); + this.removeChildren(); } } diff --git a/src/objects/room/parts/StairCorner.ts b/src/objects/room/parts/StairCorner.ts index 184e7ee5..0847ee5a 100644 --- a/src/objects/room/parts/StairCorner.ts +++ b/src/objects/room/parts/StairCorner.ts @@ -49,14 +49,11 @@ export class StairCorner extends PIXI.Container implements IRoomPart { this._container?.destroy(); } - destroyed(): void { + destroy() { + super.destroy(); this.destroySprites(); } - registered(): void { - this.updateSprites(); - } - private _createStairBoxFront(index: number): PIXI.DisplayObject[] { const baseXLeft = +stairBase * index; const baseYLeft = -stairBase * index * 1.5; diff --git a/src/objects/room/parts/Tile.ts b/src/objects/room/parts/Tile.ts index 0bd49917..49dd50c4 100644 --- a/src/objects/room/parts/Tile.ts +++ b/src/objects/room/parts/Tile.ts @@ -67,6 +67,11 @@ export class Tile extends PIXI.Container implements IRoomPart { this._updateSprites(); } + destroy() { + super.destroy(); + this._destroySprites(); + } + private _destroySprites() { this._sprites.forEach((sprite) => sprite.destroy()); this._sprites = []; diff --git a/src/objects/room/parts/TileCursor.ts b/src/objects/room/parts/TileCursor.ts index a2960cfd..06c5974c 100644 --- a/src/objects/room/parts/TileCursor.ts +++ b/src/objects/room/parts/TileCursor.ts @@ -70,9 +70,8 @@ export class TileCursor extends PIXI.Container implements HitDetectionElement { destroy() { super.destroy(); - console.log("DESTROYED"); - this._node.remove(); + this._graphics.destroy(); } private _createGraphics() { diff --git a/src/objects/room/parts/WallLeft.ts b/src/objects/room/parts/WallLeft.ts index 9c1b8c10..5728447b 100644 --- a/src/objects/room/parts/WallLeft.ts +++ b/src/objects/room/parts/WallLeft.ts @@ -60,6 +60,12 @@ export class WallLeft extends PIXI.Container implements IRoomPart { this._update(); } + destroy() { + super.destroy(); + this._hitAreaElement?.destroy(); + this.removeChildren(); + } + protected _update() { if (this._hitAreaElement != null) { this.props.hitAreaContainer.removeChild(this._hitAreaElement);