Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

phaser2-navmesh

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phaser2-navmesh - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

LICENSE

2

dist/phaser2-navmesh.min.js

@@ -1,2 +0,2 @@

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.Phaser2NavMeshPlugin=n():t.Phaser2NavMeshPlugin=n()}(window,function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=1)}([function(t,n,e){var r,i,o;!function(n){"object"==typeof t&&"object"==typeof t.exports?t.exports=n():(i=[],void 0===(o="function"==typeof(r=n)?r.apply(void 0,i):r)||(t.exports=o))}(function(){function t(t){for(var n=t,e=[];n.parent;)e.unshift(n),n=n.parent;return e}var n={search:function(e,r,o,a){e.cleanDirty();var s=(a=a||{}).heuristic||n.heuristics.manhattan,u=a.closest||!1,h=new i(function(t){return t.f}),l=r;for(r.h=s(r,o),e.markDirty(r),h.push(r);h.size()>0;){var c=h.pop();if(c===o)return t(c);c.closed=!0;for(var f=e.neighbors(c),y=0,p=f.length;y<p;++y){var d=f[y];if(!d.closed&&!d.isWall()){var v=c.g+d.getCost(c),g=d.visited;(!g||v<d.g)&&(d.visited=!0,d.parent=c,d.h=d.h||s(d,o),d.g=v,d.f=d.g+d.h,e.markDirty(d),u&&(d.h<l.h||d.h===l.h&&d.g<l.g)&&(l=d),g?h.rescoreElement(d):h.push(d))}}}return u?t(l):[]},heuristics:{manhattan:function(t,n){return Math.abs(n.x-t.x)+Math.abs(n.y-t.y)},diagonal:function(t,n){var e=Math.sqrt(2),r=Math.abs(n.x-t.x),i=Math.abs(n.y-t.y);return 1*(r+i)+(e-2)*Math.min(r,i)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function e(t,n){n=n||{},this.nodes=[],this.diagonal=!!n.diagonal,this.grid=[];for(var e=0;e<t.length;e++){this.grid[e]=[];for(var i=0,o=t[e];i<o.length;i++){var a=new r(e,i,o[i]);this.grid[e][i]=a,this.nodes.push(a)}}this.init()}function r(t,n,e){this.x=t,this.y=n,this.weight=e}function i(t){this.content=[],this.scoreFunction=t}return e.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)n.cleanNode(this.nodes[t])},e.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)n.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},e.prototype.markDirty=function(t){this.dirtyNodes.push(t)},e.prototype.neighbors=function(t){var n=[],e=t.x,r=t.y,i=this.grid;return i[e-1]&&i[e-1][r]&&n.push(i[e-1][r]),i[e+1]&&i[e+1][r]&&n.push(i[e+1][r]),i[e]&&i[e][r-1]&&n.push(i[e][r-1]),i[e]&&i[e][r+1]&&n.push(i[e][r+1]),this.diagonal&&(i[e-1]&&i[e-1][r-1]&&n.push(i[e-1][r-1]),i[e+1]&&i[e+1][r-1]&&n.push(i[e+1][r-1]),i[e-1]&&i[e-1][r+1]&&n.push(i[e-1][r+1]),i[e+1]&&i[e+1][r+1]&&n.push(i[e+1][r+1])),n},e.prototype.toString=function(){for(var t=[],n=this.grid,e=0;e<n.length;e++){for(var r=[],i=n[e],o=0;o<i.length;o++)r.push(i[o].weight);t.push(r.join(" "))}return t.join("\n")},r.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},r.prototype.getCost=function(t){return t&&t.x!=this.x&&t.y!=this.y?1.41421*this.weight:this.weight},r.prototype.isWall=function(){return 0===this.weight},i.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],n=this.content.pop();return this.content.length>0&&(this.content[0]=n,this.bubbleUp(0)),t},remove:function(t){var n=this.content.indexOf(t),e=this.content.pop();n!==this.content.length-1&&(this.content[n]=e,this.scoreFunction(e)<this.scoreFunction(t)?this.sinkDown(n):this.bubbleUp(n))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var n=this.content[t];t>0;){var e=(t+1>>1)-1,r=this.content[e];if(!(this.scoreFunction(n)<this.scoreFunction(r)))break;this.content[e]=n,this.content[t]=r,t=e}},bubbleUp:function(t){for(var n=this.content.length,e=this.content[t],r=this.scoreFunction(e);;){var i,o=t+1<<1,a=o-1,s=null;if(a<n){var u=this.content[a];(i=this.scoreFunction(u))<r&&(s=a)}if(o<n){var h=this.content[o];this.scoreFunction(h)<(null===s?r:i)&&(s=o)}if(null===s)break;this.content[t]=this.content[s],this.content[s]=e,t=s}}},{astar:n,Graph:e}})},function(t,n,e){"use strict";e.r(n);var r=e(0),i=e.n(r),o=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();var a=function(){function t(n,e){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.x=n||0,this.y=e||0}return o(t,[{key:"equals",value:function(t){return this.x===t.x&&this.y===t.y}},{key:"angle",value:function(t){return Math.atan2(t.y-this.y,t.x-this.x)}},{key:"distance",value:function(t){var n=t.x-this.x,e=t.y-this.y;return Math.sqrt(n*n+e*e)}},{key:"add",value:function(t){this.x+=t.x,this.y+=t.y}},{key:"subtract",value:function(t){this.x-=t.x,this.y-=t.y}},{key:"clone",value:function(){return new t(this.x,this.y)}}]),t}(),s=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();var u=function(){function t(n,e){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=n,this.polygon=e,this.edges=e.edges,this.neighbors=[],this.portals=[],this.centroid=this.calculateCentroid(),this.boundingRadius=this.calculateRadius(),this.weight=1}return s(t,[{key:"getPoints",value:function(){return this.polygon.points}},{key:"contains",value:function(t){return this.polygon.contains(t.x,t.y)||this.isPointOnEdge(t)}},{key:"calculateCentroid",value:function(){var t=new a(0,0),n=this.polygon.points.length;return this.polygon.points.forEach(function(n){return t.add(n)}),t.x/=n,t.y/=n,t}},{key:"calculateRadius",value:function(){var t=0,n=!0,e=!1,r=void 0;try{for(var i,o=this.polygon.points[Symbol.iterator]();!(n=(i=o.next()).done);n=!0){var a=i.value,s=this.centroid.distance(a);s>t&&(t=s)}}catch(t){e=!0,r=t}finally{try{!n&&o.return&&o.return()}finally{if(e)throw r}}return t}},{key:"isPointOnEdge",value:function(t){var n=t.x,e=t.y,r=!0,i=!1,o=void 0;try{for(var a,s=this.edges[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){if(a.value.pointOnSegment(n,e))return!0}}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return!1}},{key:"destroy",value:function(){this.neighbors=[],this.portals=[]}},{key:"toString",value:function(){return"NavPoly(id: "+this.id+" at: "+this.centroid+")"}},{key:"isWall",value:function(){return 0===this.weight}},{key:"centroidDistance",value:function(t){return this.centroid.distance(t.centroid)}},{key:"getCost",value:function(t){return this.centroidDistance(t)}}]),t}(),h=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();var l=function(){function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.nodes=n,this.init()}return h(t,[{key:"neighbors",value:function(t){return t.neighbors}},{key:"navHeuristic",value:function(t,n){return t.centroidDistance(n)}},{key:"destroy",value:function(){this.cleanDirty(),this.nodes=[]}}]),t}();l.prototype.init=i.a.Graph.prototype.init,l.prototype.cleanDirty=i.a.Graph.prototype.cleanDirty,l.prototype.markDirty=i.a.Graph.prototype.markDirty;var c=l;function f(t,n,e){var r=n.x-t.x,i=n.y-t.y;return(e.x-t.x)*i-r*(e.y-t.y)}function y(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-4;return Math.abs(t-n)<=e}function p(t,n){var e=t-n,r=e+Math.PI,i=2*Math.PI;return e=r-Math.floor(r/i)*i,e-=Math.PI}function d(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-4,r=f(t.start,t.end,n.start),i=f(t.start,t.end,n.end);return!(!y(r,0,e)||!y(i,0,e))}var v=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();var g=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.portals=[]}return v(t,[{key:"push",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;null===n&&(n=t),this.portals.push({left:t,right:n})}},{key:"stringPull",value:function(){var t,n,e,r=this.portals,i=[],o=0,a=0,s=0;t=r[0].left,n=r[0].left,e=r[0].right,i.push(t);for(var u=1;u<r.length;u++){var h=r[u].left,l=r[u].right;if(f(t,e,l)<=0){if(!(t.equals(e)||f(t,n,l)>0)){i.push(n),n=t=n,e=t,a=o=a,s=o,u=o;continue}e=l,s=u}if(f(t,n,h)>=0){if(!(t.equals(n)||f(t,e,h)<0)){i.push(e),n=t=e,e=t,a=o=s,s=o,u=o;continue}n=h,a=u}}return 0!==i.length&&i[i.length-1].equals(r[r.length-1].left)||i.push(r[r.length-1].left),this.path=i,i}}]),t}(),b=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();var x=function(){function t(n,e,r,i){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.start=new a(n,e),this.end=new a(r,i),this.left=Math.min(n,r),this.right=Math.max(n,r),this.top=Math.min(e,i),this.bottom=Math.max(e,i)}return b(t,[{key:"pointOnSegment",value:function(t,n){return t>=this.left&&t<=this.right&&n>=this.top&&n<=this.bottom&&this.pointOnLine(t,n)}},{key:"pointOnLine",value:function(t,n){return(t-this.left)*(this.bottom-this.top)==(this.right-this.left)*(n-this.top)}}]),t}(),w=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();var m=function(){function t(n){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.points=n,this.edges=[];for(var r=1;r<n.length;r++){var i=n[r-1],o=n[r];this.edges.push(new x(i.x,i.y,o.x,o.y))}if(e){var a=n[0],s=n[n.length-1];this.edges.push(new x(a.x,a.y,s.x,s.y))}}return w(t,[{key:"contains",value:function(t,n){for(var e=!1,r=-1,i=this.points.length-1;++r<this.points.length;i=r){var o=this.points[r].x,a=this.points[r].y,s=this.points[i].x,u=this.points[i].y;(a<=n&&n<u||u<=n&&n<a)&&t<(s-o)*(n-a)/(u-a)+o&&(e=!e)}return e}}]),t}(),k=function(){return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,n){var e=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(e.push(a.value),!n||e.length!==n);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return e}(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),P=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();var _=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this._meshShrinkAmount=e;var r=n.map(function(t){var n=t.map(function(t){return new a(t.x,t.y)});return new m(n)});this._navPolygons=r.map(function(t,n){return new u(n,t)}),this._calculateNeighbors(),this._graph=new c(this._navPolygons)}return P(t,[{key:"getPolygons",value:function(){return this._navPolygons}},{key:"destroy",value:function(){this._graph.destroy();var t=!0,n=!1,e=void 0;try{for(var r,i=this._navPolygons[Symbol.iterator]();!(t=(r=i.next()).done);t=!0){r.value.destroy()}}catch(t){n=!0,e=t}finally{try{!t&&i.return&&i.return()}finally{if(n)throw e}}this._navPolygons=[]}},{key:"findPath",value:function(t,n){var e=null,r=null,o=Number.MAX_VALUE,s=Number.MAX_VALUE,u=void 0,h=void 0,l=new a(t.x,t.y),c=new a(n.x,n.y),f=!0,y=!1,p=void 0;try{for(var d,v=this._navPolygons[Symbol.iterator]();!(f=(d=v.next()).done);f=!0){var b=d.value;h=b.boundingRadius,(u=b.centroid.distance(l))<=o&&u<=h&&b.contains(l)&&(e=b,o=u),(u=b.centroid.distance(c))<=s&&u<=h&&b.contains(c)&&(r=b,s=u)}}catch(t){y=!0,p=t}finally{try{!f&&v.return&&v.return()}finally{if(y)throw p}}if(!e&&this._meshShrinkAmount>0){var x=!0,w=!1,m=void 0;try{for(var k,P=this._navPolygons[Symbol.iterator]();!(x=(k=P.next()).done);x=!0){var _=k.value;if(h=_.boundingRadius+this._meshShrinkAmount,(u=_.centroid.distance(l))<=h){var M=this._projectPointToPolygon(l,_).distance;M<=this._meshShrinkAmount&&M<o&&(e=_,o=M)}}}catch(t){w=!0,m=t}finally{try{!x&&P.return&&P.return()}finally{if(w)throw m}}}if(!r&&this._meshShrinkAmount>0){var G=!0,S=!1,j=void 0;try{for(var O,E=this._navPolygons[Symbol.iterator]();!(G=(O=E.next()).done);G=!0){var N=O.value;if(h=N.boundingRadius+this._meshShrinkAmount,(u=N.centroid.distance(c))<=h){var T=this._projectPointToPolygon(c,N).distance;T<=this._meshShrinkAmount&&T<s&&(r=N,s=T)}}}catch(t){S=!0,j=t}finally{try{!G&&E.return&&E.return()}finally{if(S)throw j}}}if(!e||!r)return null;if(e===r)return[l,c];var D=i.a.astar.search(this._graph,e,r,{heuristic:this._graph.navHeuristic});if(0===D.length)return null;D.unshift(e);var A=new g;A.push(l);for(var F=0;F<D.length-1;F++){for(var C=D[F],q=D[F+1],R=null,U=0;U<C.neighbors.length;U++)C.neighbors[U].id===q.id&&(R=C.portals[U]);A.push(R.start,R.end)}A.push(c),A.stringPull();var L=null,I=[],W=!0,V=!1,X=void 0;try{for(var z,H=A.path[Symbol.iterator]();!(W=(z=H.next()).done);W=!0){var B=z.value.clone();L&&B.equals(L)||I.push(B),L=B}}catch(t){V=!0,X=t}finally{try{!W&&H.return&&H.return()}finally{if(V)throw X}}return I}},{key:"_calculateNeighbors",value:function(){for(var t=0;t<this._navPolygons.length;t++)for(var n=this._navPolygons[t],e=t+1;e<this._navPolygons.length;e++){var r=this._navPolygons[e];if(!(n.centroid.distance(r.centroid)>n.boundingRadius+r.boundingRadius)){var i=!0,o=!1,a=void 0;try{for(var s,u=n.edges[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var h=s.value,l=!0,c=!1,f=void 0;try{for(var y,v=r.edges[Symbol.iterator]();!(l=(y=v.next()).done);l=!0){var g=y.value;if(d(h,g)){var b=this._getSegmentOverlap(h,g);if(b){n.neighbors.push(r),r.neighbors.push(n);var w=k(b,2),m=w[0],P=w[1],_=n.centroid.angle(h.start),M=n.centroid.angle(b[0]),G=n.centroid.angle(b[1]),S=p(_,M),j=p(_,G);S<j?n.portals.push(new x(m.x,m.y,P.x,P.y)):n.portals.push(new x(P.x,P.y,m.x,m.y)),_=r.centroid.angle(g.start),M=r.centroid.angle(b[0]),G=r.centroid.angle(b[1]),(S=p(_,M))<(j=p(_,G))?r.portals.push(new x(m.x,m.y,P.x,P.y)):r.portals.push(new x(P.x,P.y,m.x,m.y))}}}}catch(t){c=!0,f=t}finally{try{!l&&v.return&&v.return()}finally{if(c)throw f}}}}catch(t){o=!0,a=t}finally{try{!i&&u.return&&u.return()}finally{if(o)throw a}}}}}},{key:"_getSegmentOverlap",value:function(t,n){var e=[{line:t,point:t.start},{line:t,point:t.end},{line:n,point:n.start},{line:n,point:n.end}];e.sort(function(t,n){return t.point.x<n.point.x?-1:t.point.x>n.point.x?1:t.point.y<n.point.y?-1:t.point.y>n.point.y?1:0});var r=e[0].line===e[1].line,i=e[1].point.equals(e[2].point);return r||i?null:[e[1].point,e[2].point]}},{key:"_projectPointToPolygon",value:function(t,n){var e=null,r=Number.MAX_VALUE,i=!0,o=!1,a=void 0;try{for(var s,u=n.edges[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var h=s.value,l=this._projectPointToEdge(t,h),c=t.distance(l);(null===e||c<r)&&(r=c,e=l)}}catch(t){o=!0,a=t}finally{try{!i&&u.return&&u.return()}finally{if(o)throw a}}return{point:e,distance:r}}},{key:"_distanceSquared",value:function(t,n){var e=n.x-t.x,r=n.y-t.y;return e*e+r*r}},{key:"_projectPointToEdge",value:function(t,n){var e=n.start,r=n.end,i=this._distanceSquared(e,r),o=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return o=function(t,n,e){return t<n&&(t=n),t>e&&(t=e),t}(o,0,1),new a(e.x+o*(r.x-e.x),e.y+o*(r.y-e.y))}}]),t}(),M=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();function G(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)}var S=function(){function t(n,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.key=e,this.plugin=n,this.game=n.game,this.debugGraphics=null,this.navMesh=new _(r,i)}return M(t,[{key:"findPath",value:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Phaser.Point,r=this.navMesh.findPath(t,n);return r?r.map(function(t){var n=t.x,r=t.y;return new e(n,r)}):r}},{key:"enableDebug",value:function(t){return t||this.debugGraphics?t&&(this.debugGraphics&&this.debugGraphics.destroy(),this.debugGraphics=t):this.debugGraphics=this.game.add.graphics(),this.debugGraphics.visible=!0,this.debugGraphics}},{key:"disableDebug",value:function(){this.debugGraphics&&(this.debugGraphics.visible=!1)}},{key:"isDebugEnabled",value:function(){return this.debugGraphics&&this.debugGraphics.visible}},{key:"debugDrawClear",value:function(){this.debugGraphics&&this.debugGraphics.clear()}},{key:"debugDrawMesh",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=n.drawCentroid,r=void 0===e||e,i=n.drawBounds,o=void 0!==i&&i,a=n.drawNeighbors,s=void 0===a||a,u=n.drawPortals,h=void 0===u||u,l=n.palette,c=void 0===l?[41136,6965820,13382463,15427649,15583569]:l;this.debugGraphics&&this.navMesh.getPolygons().forEach(function(n){var e=c[n.id%c.length];if(t.debugGraphics.lineWidth=0,t.debugGraphics.beginFill(e),t.debugGraphics.drawPolygon(new(Function.prototype.bind.apply(Phaser.Polygon,[null].concat(G(n.getPoints()))))),t.debugGraphics.endFill(),r&&(t.debugGraphics.beginFill(0),t.debugGraphics.drawEllipse(n.centroid.x,n.centroid.y,4,4),t.debugGraphics.endFill()),o){t.debugGraphics.lineStyle(1,16777215);var i=n.boundingRadius;t.debugGraphics.drawEllipse(n.centroid.x,n.centroid.y,i,i)}s&&(t.debugGraphics.lineStyle(2,0),n.neighbors.forEach(function(e){t.debugGraphics.moveTo(n.centroid.x,n.centroid.y),t.debugGraphics.lineTo(e.centroid.x,e.centroid.y)})),h&&(t.debugGraphics.lineStyle(10,0),n.portals.forEach(function(n){t.debugGraphics.moveTo(n.start.x,n.start.y),t.debugGraphics.lineTo(n.end.x,n.end.y)}))})}},{key:"debugDrawPath",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:65280,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(this.debugGraphics&&t&&t.length){this.debugGraphics.lineStyle(e,n,r),this.debugGraphics.drawShape(new(Function.prototype.bind.apply(Phaser.Polygon,[null].concat(G(t))))),this.debugGraphics.beginFill(n,r);var i=.5*e;if(this.debugGraphics.drawEllipse(t[0].x,t[0].y,i,i),t.length>1){var o=t[t.length-1];this.debugGraphics.drawEllipse(o.x,o.y,i,i)}this.debugGraphics.endFill()}}},{key:"destroy",value:function(){this.navMesh&&this.navMesh.destroy(),this.debugGraphics&&this.debugGraphics.destroy(),this.plugin.removeMesh(this.key),this.navMesh=void 0,this.debugGraphics=void 0,this.plugin=void 0,this.scene=void 0}}]),t}(),j=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();var O=function(t){function n(t,e){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n);var r=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n}(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return r.phaserNavMeshes={},r}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)}(n,Phaser.Plugin),j(n,[{key:"destroy",value:function(){var t=Object.values(this.phaserNavMeshes);this.phaserNavMeshes={},t.forEach(function(t){return t.destroy()}),this.game=void 0}},{key:"removeMesh",value:function(t){this.phaserNavMeshes[t]&&(this.phaserNavMeshes[t]=void 0)}},{key:"buildMeshFromTiled",value:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(this.phaserNavMeshes[t])return console.warn("NavMeshPlugin: a navmesh already exists with the given key: "+t),this.phaserNavMeshes[t];n&&0!==n.length||console.warn("NavMeshPlugin: The given tilemap object layer is empty or undefined: "+n);var r=(n||[]).map(function(t){var n=t.y,e=t.y+t.height,r=t.x,i=t.x+t.width;return[{x:r,y:n},{x:r,y:e},{x:i,y:e},{x:i,y:n}]}),i=new S(this,t,r,e);return this.phaserNavMeshes[t]=i,i}}]),n}();e.d(n,"Phaser2NavMesh",function(){return S});n.default=O}]).default});
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.Phaser2NavMeshPlugin=n():t.Phaser2NavMeshPlugin=n()}(window,function(){return function(t){var n={};function e(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,e),s.l=!0,s.exports}return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var s in t)e.d(i,s,function(n){return t[n]}.bind(null,s));return i},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=1)}([function(t,n,e){var i,s,o;!function(n){"object"==typeof t.exports?t.exports=n():(s=[],void 0===(o="function"==typeof(i=n)?i.apply(void 0,s):i)||(t.exports=o))}(function(){function t(t){for(var n=t,e=[];n.parent;)e.unshift(n),n=n.parent;return e}var n={search:function(e,i,o,r){e.cleanDirty();var h=(r=r||{}).heuristic||n.heuristics.manhattan,a=r.closest||!1,c=new s(function(t){return t.f}),u=i;for(i.h=h(i,o),e.markDirty(i),c.push(i);c.size()>0;){var l=c.pop();if(l===o)return t(l);l.closed=!0;for(var d=e.neighbors(l),p=0,g=d.length;p<g;++p){var y=d[p];if(!y.closed&&!y.isWall()){var f=l.g+y.getCost(l),b=y.visited;(!b||f<y.g)&&(y.visited=!0,y.parent=l,y.h=y.h||h(y,o),y.g=f,y.f=y.g+y.h,e.markDirty(y),a&&(y.h<u.h||y.h===u.h&&y.g<u.g)&&(u=y),b?c.rescoreElement(y):c.push(y))}}}return a?t(u):[]},heuristics:{manhattan:function(t,n){return Math.abs(n.x-t.x)+Math.abs(n.y-t.y)},diagonal:function(t,n){var e=Math.sqrt(2),i=Math.abs(n.x-t.x),s=Math.abs(n.y-t.y);return 1*(i+s)+(e-2)*Math.min(i,s)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function e(t,n){n=n||{},this.nodes=[],this.diagonal=!!n.diagonal,this.grid=[];for(var e=0;e<t.length;e++){this.grid[e]=[];for(var s=0,o=t[e];s<o.length;s++){var r=new i(e,s,o[s]);this.grid[e][s]=r,this.nodes.push(r)}}this.init()}function i(t,n,e){this.x=t,this.y=n,this.weight=e}function s(t){this.content=[],this.scoreFunction=t}return e.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)n.cleanNode(this.nodes[t])},e.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)n.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},e.prototype.markDirty=function(t){this.dirtyNodes.push(t)},e.prototype.neighbors=function(t){var n=[],e=t.x,i=t.y,s=this.grid;return s[e-1]&&s[e-1][i]&&n.push(s[e-1][i]),s[e+1]&&s[e+1][i]&&n.push(s[e+1][i]),s[e]&&s[e][i-1]&&n.push(s[e][i-1]),s[e]&&s[e][i+1]&&n.push(s[e][i+1]),this.diagonal&&(s[e-1]&&s[e-1][i-1]&&n.push(s[e-1][i-1]),s[e+1]&&s[e+1][i-1]&&n.push(s[e+1][i-1]),s[e-1]&&s[e-1][i+1]&&n.push(s[e-1][i+1]),s[e+1]&&s[e+1][i+1]&&n.push(s[e+1][i+1])),n},e.prototype.toString=function(){for(var t=[],n=this.grid,e=0;e<n.length;e++){for(var i=[],s=n[e],o=0;o<s.length;o++)i.push(s[o].weight);t.push(i.join(" "))}return t.join("\n")},i.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},i.prototype.getCost=function(t){return t&&t.x!=this.x&&t.y!=this.y?1.41421*this.weight:this.weight},i.prototype.isWall=function(){return 0===this.weight},s.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],n=this.content.pop();return this.content.length>0&&(this.content[0]=n,this.bubbleUp(0)),t},remove:function(t){var n=this.content.indexOf(t),e=this.content.pop();n!==this.content.length-1&&(this.content[n]=e,this.scoreFunction(e)<this.scoreFunction(t)?this.sinkDown(n):this.bubbleUp(n))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var n=this.content[t];t>0;){var e=(t+1>>1)-1,i=this.content[e];if(!(this.scoreFunction(n)<this.scoreFunction(i)))break;this.content[e]=n,this.content[t]=i,t=e}},bubbleUp:function(t){for(var n=this.content.length,e=this.content[t],i=this.scoreFunction(e);;){var s,o=t+1<<1,r=o-1,h=null;if(r<n){var a=this.content[r];(s=this.scoreFunction(a))<i&&(h=r)}if(o<n){var c=this.content[o];this.scoreFunction(c)<(null===h?i:s)&&(h=o)}if(null===h)break;this.content[t]=this.content[h],this.content[h]=e,t=h}}},{astar:n,Graph:e}})},function(t,n,e){"use strict";e.r(n);var i=e(0),s=e.n(i);class o{constructor(t,n){this.x=t||0,this.y=n||0}equals(t){return this.x===t.x&&this.y===t.y}angle(t){return Math.atan2(t.y-this.y,t.x-this.x)}distance(t){const n=t.x-this.x,e=t.y-this.y;return Math.sqrt(n*n+e*e)}add(t){this.x+=t.x,this.y+=t.y}subtract(t){this.x-=t.x,this.y-=t.y}clone(){return new o(this.x,this.y)}}class r{constructor(t,n){this.id=t,this.polygon=n,this.edges=n.edges,this.neighbors=[],this.portals=[],this.centroid=this.calculateCentroid(),this.boundingRadius=this.calculateRadius(),this.weight=1}getPoints(){return this.polygon.points}contains(t){return this.polygon.contains(t.x,t.y)||this.isPointOnEdge(t)}calculateCentroid(){const t=new o(0,0),n=this.polygon.points.length;return this.polygon.points.forEach(n=>t.add(n)),t.x/=n,t.y/=n,t}calculateRadius(){let t=0;for(const n of this.polygon.points){const e=this.centroid.distance(n);e>t&&(t=e)}return t}isPointOnEdge({x:t,y:n}){for(const e of this.edges)if(e.pointOnSegment(t,n))return!0;return!1}destroy(){this.neighbors=[],this.portals=[]}toString(){return`NavPoly(id: ${this.id} at: ${this.centroid})`}isWall(){return 0===this.weight}centroidDistance(t){return this.centroid.distance(t.centroid)}getCost(t){return this.centroidDistance(t)}}class h{constructor(t){this.nodes=t,this.init()}neighbors(t){return t.neighbors}navHeuristic(t,n){return t.centroidDistance(n)}destroy(){this.cleanDirty(),this.nodes=[]}}h.prototype.init=s.a.Graph.prototype.init,h.prototype.cleanDirty=s.a.Graph.prototype.cleanDirty,h.prototype.markDirty=s.a.Graph.prototype.markDirty;var a=h;function c(t,n,e){const i=n.x-t.x,s=n.y-t.y;return(e.x-t.x)*s-i*(e.y-t.y)}function u(t,n,e=1e-4){return Math.abs(t-n)<=e}function l(t,n){let e=t-n;const i=e+Math.PI,s=2*Math.PI;return e=i-Math.floor(i/s)*s,e-=Math.PI}function d(t,n,e=1e-4){const i=c(t.start,t.end,n.start),s=c(t.start,t.end,n.end);return!(!u(i,0,e)||!u(s,0,e))}var p=class{constructor(){this.portals=[]}push(t,n=null){null===n&&(n=t),this.portals.push({left:t,right:n})}stringPull(){var t,n,e,i=this.portals,s=[],o=0,r=0,h=0;t=i[0].left,n=i[0].left,e=i[0].right,s.push(t);for(var a=1;a<i.length;a++){var u=i[a].left,l=i[a].right;if(c(t,e,l)<=0){if(!(t.equals(e)||c(t,n,l)>0)){s.push(n),n=t=n,e=t,r=o=r,h=o,a=o;continue}e=l,h=a}if(c(t,n,u)>=0){if(!(t.equals(n)||c(t,e,u)<0)){s.push(e),n=t=e,e=t,r=o=h,h=o,a=o;continue}n=u,r=a}}return 0!==s.length&&s[s.length-1].equals(i[i.length-1].left)||s.push(i[i.length-1].left),this.path=s,s}};class g{constructor(t,n,e,i){this.start=new o(t,n),this.end=new o(e,i),this.left=Math.min(t,e),this.right=Math.max(t,e),this.top=Math.min(n,i),this.bottom=Math.max(n,i)}pointOnSegment(t,n){return t>=this.left&&t<=this.right&&n>=this.top&&n<=this.bottom&&this.pointOnLine(t,n)}pointOnLine(t,n){return(t-this.left)*(this.bottom-this.top)==(this.right-this.left)*(n-this.top)}}class y{constructor(t,n=!0){this.points=t,this.edges=[];for(let n=1;n<t.length;n++){const e=t[n-1],i=t[n];this.edges.push(new g(e.x,e.y,i.x,i.y))}if(n){const n=t[0],e=t[t.length-1];this.edges.push(new g(n.x,n.y,e.x,e.y))}}contains(t,n){let e=!1;for(let i=-1,s=this.points.length-1;++i<this.points.length;s=i){const o=this.points[i].x,r=this.points[i].y,h=this.points[s].x,a=this.points[s].y;(r<=n&&n<a||a<=n&&n<r)&&t<(h-o)*(n-r)/(a-r)+o&&(e=!e)}return e}}var f=class{constructor(t,n=0){this._meshShrinkAmount=n;const e=t.map(t=>{const n=t.map(t=>new o(t.x,t.y));return new y(n)});this._navPolygons=e.map((t,n)=>new r(n,t)),this._calculateNeighbors(),this._graph=new a(this._navPolygons)}getPolygons(){return this._navPolygons}destroy(){this._graph.destroy();for(const t of this._navPolygons)t.destroy();this._navPolygons=[]}findPath(t,n){let e,i,r=null,h=null,a=Number.MAX_VALUE,c=Number.MAX_VALUE;const u=new o(t.x,t.y),l=new o(n.x,n.y);for(const t of this._navPolygons)i=t.boundingRadius,(e=t.centroid.distance(u))<=a&&e<=i&&t.contains(u)&&(r=t,a=e),(e=t.centroid.distance(l))<=c&&e<=i&&t.contains(l)&&(h=t,c=e);if(!r&&this._meshShrinkAmount>0)for(const t of this._navPolygons)if(i=t.boundingRadius+this._meshShrinkAmount,(e=t.centroid.distance(u))<=i){const{distance:n}=this._projectPointToPolygon(u,t);n<=this._meshShrinkAmount&&n<a&&(r=t,a=n)}if(!h&&this._meshShrinkAmount>0)for(const t of this._navPolygons)if(i=t.boundingRadius+this._meshShrinkAmount,(e=t.centroid.distance(l))<=i){const{distance:n}=this._projectPointToPolygon(l,t);n<=this._meshShrinkAmount&&n<c&&(h=t,c=n)}if(!r||!h)return null;if(r===h)return[u,l];const d=s.a.astar.search(this._graph,r,h,{heuristic:this._graph.navHeuristic});if(0===d.length)return null;d.unshift(r);const g=new p;g.push(u);for(let t=0;t<d.length-1;t++){const n=d[t],e=d[t+1];let i=null;for(let t=0;t<n.neighbors.length;t++)n.neighbors[t].id===e.id&&(i=n.portals[t]);g.push(i.start,i.end)}g.push(l),g.stringPull();let y=null;const f=[];for(const t of g.path){const n=t.clone();y&&n.equals(y)||f.push(n),y=n}return f}_calculateNeighbors(){for(let t=0;t<this._navPolygons.length;t++){const n=this._navPolygons[t];for(let e=t+1;e<this._navPolygons.length;e++){const t=this._navPolygons[e];if(!(n.centroid.distance(t.centroid)>n.boundingRadius+t.boundingRadius))for(const e of n.edges)for(const i of t.edges){if(!d(e,i))continue;const s=this._getSegmentOverlap(e,i);if(!s)continue;n.neighbors.push(t),t.neighbors.push(n);const[o,r]=s;let h=n.centroid.angle(e.start),a=n.centroid.angle(s[0]),c=n.centroid.angle(s[1]),u=l(h,a),p=l(h,c);u<p?n.portals.push(new g(o.x,o.y,r.x,r.y)):n.portals.push(new g(r.x,r.y,o.x,o.y)),h=t.centroid.angle(i.start),a=t.centroid.angle(s[0]),c=t.centroid.angle(s[1]),(u=l(h,a))<(p=l(h,c))?t.portals.push(new g(o.x,o.y,r.x,r.y)):t.portals.push(new g(r.x,r.y,o.x,o.y))}}}}_getSegmentOverlap(t,n){const e=[{line:t,point:t.start},{line:t,point:t.end},{line:n,point:n.start},{line:n,point:n.end}];e.sort(function(t,n){return t.point.x<n.point.x?-1:t.point.x>n.point.x?1:t.point.y<n.point.y?-1:t.point.y>n.point.y?1:0});const i=e[0].line===e[1].line,s=e[1].point.equals(e[2].point);return i||s?null:[e[1].point,e[2].point]}_projectPointToPolygon(t,n){let e=null,i=Number.MAX_VALUE;for(const s of n.edges){const n=this._projectPointToEdge(t,s),o=t.distance(n);(null===e||o<i)&&(i=o,e=n)}return{point:e,distance:i}}_distanceSquared(t,n){const e=n.x-t.x,i=n.y-t.y;return e*e+i*i}_projectPointToEdge(t,n){const e=n.start,i=n.end,s=this._distanceSquared(e,i);let r=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/s;return r=function(t,n,e){return t<n&&(t=n),t>e&&(t=e),t}(r,0,1),new o(e.x+r*(i.x-e.x),e.y+r*(i.y-e.y))}};class b{constructor(t,n,e,i=0){this.key=n,this.plugin=t,this.game=t.game,this.debugGraphics=null,this.navMesh=new f(e,i)}findPath(t,n,e=Phaser.Point){const i=this.navMesh.findPath(t,n);return i?i.map(({x:t,y:n})=>new e(t,n)):i}enableDebug(t){return t||this.debugGraphics?t&&(this.debugGraphics&&this.debugGraphics.destroy(),this.debugGraphics=t):this.debugGraphics=this.game.add.graphics(),this.debugGraphics.visible=!0,this.debugGraphics}disableDebug(){this.debugGraphics&&(this.debugGraphics.visible=!1)}isDebugEnabled(){return this.debugGraphics&&this.debugGraphics.visible}debugDrawClear(){this.debugGraphics&&this.debugGraphics.clear()}debugDrawMesh({drawCentroid:t=!0,drawBounds:n=!1,drawNeighbors:e=!0,drawPortals:i=!0,palette:s=[41136,6965820,13382463,15427649,15583569]}={}){if(!this.debugGraphics)return;this.navMesh.getPolygons().forEach(o=>{const r=s[o.id%s.length];if(this.debugGraphics.lineWidth=0,this.debugGraphics.beginFill(r),this.debugGraphics.drawPolygon(new Phaser.Polygon(...o.getPoints())),this.debugGraphics.endFill(),t&&(this.debugGraphics.beginFill(0),this.debugGraphics.drawEllipse(o.centroid.x,o.centroid.y,4,4),this.debugGraphics.endFill()),n){this.debugGraphics.lineStyle(1,16777215);const t=o.boundingRadius;this.debugGraphics.drawEllipse(o.centroid.x,o.centroid.y,t,t)}e&&(this.debugGraphics.lineStyle(2,0),o.neighbors.forEach(t=>{this.debugGraphics.moveTo(o.centroid.x,o.centroid.y),this.debugGraphics.lineTo(t.centroid.x,t.centroid.y)})),i&&(this.debugGraphics.lineStyle(10,0),o.portals.forEach(t=>{this.debugGraphics.moveTo(t.start.x,t.start.y),this.debugGraphics.lineTo(t.end.x,t.end.y)}))})}debugDrawPath(t,n=65280,e=10,i=1){if(this.debugGraphics&&t&&t.length){this.debugGraphics.lineStyle(e,n,i),this.debugGraphics.drawShape(new Phaser.Polygon(...t)),this.debugGraphics.beginFill(n,i);const s=.5*e;if(this.debugGraphics.drawEllipse(t[0].x,t[0].y,s,s),t.length>1){const n=t[t.length-1];this.debugGraphics.drawEllipse(n.x,n.y,s,s)}this.debugGraphics.endFill()}}destroy(){this.navMesh&&this.navMesh.destroy(),this.debugGraphics&&this.debugGraphics.destroy(),this.plugin.removeMesh(this.key),this.navMesh=void 0,this.debugGraphics=void 0,this.plugin=void 0,this.scene=void 0}}e.d(n,"Phaser2NavMesh",function(){return b});n.default=class extends Phaser.Plugin{constructor(t,n){super(t,n),this.phaserNavMeshes={}}destroy(){const t=Object.values(this.phaserNavMeshes);this.phaserNavMeshes={},t.forEach(t=>t.destroy()),this.game=void 0}removeMesh(t){this.phaserNavMeshes[t]&&(this.phaserNavMeshes[t]=void 0)}buildMeshFromTiled(t,n,e=0){if(this.phaserNavMeshes[t])return console.warn(`NavMeshPlugin: a navmesh already exists with the given key: ${t}`),this.phaserNavMeshes[t];n&&0!==n.length||console.warn(`NavMeshPlugin: The given tilemap object layer is empty or undefined: ${n}`);const i=(n||[]).map(t=>{const n=t.y,e=t.y+t.height,i=t.x,s=t.x+t.width;return[{x:i,y:n},{x:i,y:e},{x:s,y:e},{x:s,y:n}]}),s=new b(this,t,i,e);return this.phaserNavMeshes[t]=s,s}}}]).default});
//# sourceMappingURL=phaser2-navmesh.min.js.map
{
"name": "phaser2-navmesh",
"version": "2.0.4",
"version": "2.0.5",
"description": "A plugin for Phaser (v2) for fast pathfinding using navigation meshes",

@@ -13,3 +13,3 @@ "main": "dist/phaser2-navmesh.min.js",

"dependencies": {
"navmesh": "^2.0.2"
"navmesh": "^2.0.3"
},

@@ -20,6 +20,6 @@ "peerDependencies": {

"devDependencies": {
"babel-core": "^6.26.3",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"babel-jest": "^23.2.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"babel-loader": "^8.0.6",
"jest": "^23.2.0",

@@ -48,3 +48,4 @@ "uglifyjs-webpack-plugin": "^1.2.7",

},
"homepage": "https://github.com/mikewesthad/phaser-navmesh-plugin#readme"
"homepage": "https://github.com/mikewesthad/phaser-navmesh-plugin#readme",
"gitHead": "f5fdc676b88a7ac85cf2c169428efb7851de7f5d"
}

@@ -9,4 +9,8 @@ # Phaser 2 NavMesh

Version 2.0.5 - 2019-08-04
- Bug: fixed webpack config so that it applied babel transform and so that it worked under node environments, thanks to [@will-hart](https://github.com/will-hart)
Version 2.0.4 - 2018-01-03
- Bug: fixed a bug when destroying navmeshes, thanks to [@GGAlanSmithee](https://github.com/GGAlanSmithee) for pointing it out

@@ -110,3 +110,3 @@ import NavMesh from "navmesh/src"; // import the source - not the dist - no need to double build

* of Phaser-compatible format colors to use when drawing the individual polygons. The first poly
* uses the first color, the second poly uses the second color, etc.
* uses the first color, the second poly uses the second color, etc.
* @memberof Phaser2NavMesh

@@ -165,3 +165,3 @@ */

*
* @param {object[]} path Array of point-like objects in the form {x, y}
* @param {object[]} path Array of point-like objects in the form {x, y}
* @param {number} [color=0x00FF00]

@@ -168,0 +168,0 @@ * @param {number} [thickness=10]

@@ -34,3 +34,3 @@ /* eslint-env node */

exclude: /node_modules/,
use: ["babel-loader"]
use: { loader: "babel-loader", options: { root: "../../" } }
}

@@ -37,0 +37,0 @@ ]

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc