Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const polygons = objects.map(obj => {
const top = obj.y;
const bottom = obj.y + obj.height;
const left = obj.x;
const right = obj.x + obj.width;
return [
{ x: left, y: top },
{ x: left, y: bottom },
{ x: right, y: bottom },
{ x: right, y: top }
];
// return new Phaser.Geom.Polygon([[left, top], [left, bottom], [right, bottom], [right, top]]);
});
// Build the navmesh
const mesh = new NavMesh(polygons, meshShrinkAmount);
this.navMeshes.push(mesh);
return mesh;
}
constructor(plugin, key, meshPolygonPoints, meshShrinkAmount = 0) {
this.key = key;
this.plugin = plugin;
this.scene = plugin.scene;
this.debugGraphics = null;
this.navMesh = new NavMesh(meshPolygonPoints, meshShrinkAmount);
}
constructor(plugin, key, meshPolygonPoints, meshShrinkAmount = 0) {
this.key = key;
this.plugin = plugin;
this.game = plugin.game;
this.debugGraphics = null;
this.navMesh = new NavMesh(meshPolygonPoints, meshShrinkAmount);
}