From 169f6284c89db8eaf05ef2db865f62842f2b2902 Mon Sep 17 00:00:00 2001 From: Sylvain Breton Date: Wed, 1 Nov 2023 09:45:32 +0100 Subject: [PATCH] fix: on updating to phaser 3.6 scenePlugin type can have scene set to null. This triggered errors on the plugin. I used the ! operator to fix those errors --- packages/phaser-navmesh/src/phaser-navmesh-plugin.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/phaser-navmesh/src/phaser-navmesh-plugin.ts b/packages/phaser-navmesh/src/phaser-navmesh-plugin.ts index 7490b91..b060350 100644 --- a/packages/phaser-navmesh/src/phaser-navmesh-plugin.ts +++ b/packages/phaser-navmesh/src/phaser-navmesh-plugin.ts @@ -23,7 +23,7 @@ export default class PhaserNavMeshPlugin extends Phaser.Plugins.ScenePlugin { /** Phaser.Scene lifecycle event */ public boot() { - const emitter = this.systems.events; + const emitter = this.systems!.events; emitter.once("destroy", this.destroy, this); } @@ -35,7 +35,7 @@ export default class PhaserNavMeshPlugin extends Phaser.Plugins.ScenePlugin { /** Phaser.Scene lifecycle event - will destroy all navmeshes created. */ public destroy() { - this.systems.events.off("boot", this.boot, this); + this.systems!.events.off("boot", this.boot, this); this.removeAllMeshes(); } @@ -162,7 +162,7 @@ export default class PhaserNavMeshPlugin extends Phaser.Plugins.ScenePlugin { ); } - const mesh = new PhaserNavMesh(this, this.scene, key, polygons, 0); + const mesh = new PhaserNavMesh(this, this.scene!, key, polygons, 0); this.phaserNavMeshes[key] = mesh; return mesh; @@ -212,7 +212,7 @@ export default class PhaserNavMeshPlugin extends Phaser.Plugins.ScenePlugin { ]; }); - const mesh = new PhaserNavMesh(this, this.scene, key, polygons, meshShrinkAmount); + const mesh = new PhaserNavMesh(this, this.scene!, key, polygons, meshShrinkAmount); this.phaserNavMeshes[key] = mesh;