enter and leave zone events

This commit is contained in:
Hanusiak Piotr 2021-12-08 13:18:06 +01:00
parent 03cf5c05ff
commit 4d473480cf
5 changed files with 39 additions and 9 deletions

View file

@ -196,9 +196,6 @@ export class GameMap {
*/
private triggerZonesChange(): void {
const zones = this.tiledObjects.filter((object) => object.type === "zone");
// P.H. NOTE: We could also get all of the zones and add properties of occupied tiles to them, so we could later on check collision by using tileKeys
// TODO: Change this to an array with currently occupied sone instead of doing elimination process
const zonesByOldPosition = this.oldPosition
? zones.filter((zone) => {
if (!this.oldPosition) {

View file

@ -798,9 +798,9 @@ export class GameScene extends DirtyScene {
break;
}
}
// zones.forEach((zone) => {
// iframeListener.sendEnterLayerEvent(zone.name);
// });
zones.forEach((zone) => {
iframeListener.sendEnterZoneEvent(zone.name);
});
});
this.gameMap.onLeaveZone((zones) => {
@ -811,9 +811,9 @@ export class GameScene extends DirtyScene {
break;
}
}
// zones.forEach((zone) => {
// iframeListener.sendEnterLayerEvent(zone.name);
// });
zones.forEach((zone) => {
iframeListener.sendLeaveZoneEvent(zone.name);
});
});
// this.gameMap.onLeaveLayer((layers) => {