X-Git-Url: https://git.r.bdr.sh/rbdr/serpentity/blobdiff_plain/4c329508c3a6c56076c110cd4397fef0a219f7ce..8af8134e5727b9943ff6261175cf35c311f1ad23:/dist/serpentity.min.js diff --git a/dist/serpentity.min.js b/dist/serpentity.min.js new file mode 100644 index 0000000..abf6ba1 --- /dev/null +++ b/dist/serpentity.min.js @@ -0,0 +1 @@ +"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n=0?!1:(e.priority=t,o=!1,n=0,this.systems.some(function(t,i){return n=i,t.priority>=e.priority?(o=!0,!0):void 0}),o||(n+=1),this.systems.splice(n,0,e),e.added(this),!0)}},{key:"removeSystem",value:function(e){var t=void 0;return t=this.systems.indexOf(e),t>=0?(this.systems[t].removed(this),this.systems.splice(t,1),!0):!1}},{key:"addEntity",value:function(e){return this.entities.indexOf(e)>=0?!1:(this.entities.push(e),this._nodeCollections.forEach(function(t){t.add(e)}),!0)}},{key:"removeEntity",value:function(e){var t=void 0;return t=this.entities.indexOf(e),t>=0?(this._nodeCollections.forEach(function(t){t.remove(e)}),this.entities.splice(t,1),!0):!1}},{key:"getNodes",value:function(t){var n=void 0,o=void 0;return n=this._nodeCollectionKeys.indexOf(t),n>=0?this._nodeCollections[n].nodes:(o=new e.NodeCollection({type:t}),this._nodeCollectionKeys.push(t),this._nodeCollections.push(o),this.entities.forEach(function(e){o.add(e)}),o.nodes)}},{key:"update",value:function(e){this.systems.forEach(function(t){t.update(e)})}}]),e}();"undefined"!=typeof module&&(void 0).module!==module&&(Serpentity.Component=require("./serpentity/component.js"),Serpentity.Entity=require("./serpentity/entity.js"),Serpentity.Node=require("./serpentity/node.js"),Serpentity.NodeCollection=require("./serpentity/node_collection.js"),Serpentity.System=require("./serpentity/system.js"),module.exports=Serpentity);var _createClass=function(){function e(e,t){for(var n=0;n=0?!1:(this._componentKeys.push(e.constructor),this._components.push(e),!0)}},{key:"hasComponent",value:function(e){return!!(this._componentKeys.indexOf(e)>=0)}},{key:"getComponent",value:function(e){var t=this._componentKeys.indexOf(e);return t>=0?this._components[t]:void 0}}]),e}();"undefined"!=typeof module&&(void 0).module!==module?module.exports=Entity:Serpentity.Entity=Entity;var _createClass=function(){function e(e,t){for(var n=0;n=0?(this.nodes.splice(t,1),!0):!1}},{key:"_entityExists",value:function(e){var t=!1,n=!0,o=!1,i=void 0;try{for(var s,r=this.nodes[Symbol.iterator]();!(n=(s=r.next()).done);n=!0){var a=s.value;a.entity===e&&(t=!0)}}catch(l){o=!0,i=l}finally{try{!n&&r["return"]&&r["return"]()}finally{if(o)throw i}}return t}}]),e}();"undefined"!=typeof module&&(void 0).module!==module?module.exports=NodeCollection:Serpentity.NodeCollection=NodeCollection;var Component=function e(t){_classCallCheck(this,e),Object.assign(this,t||{})};"undefined"!=typeof module&&(void 0).module!==module?module.exports=Component:Serpentity.Component=Component;var _createClass=function(){function e(e,t){for(var n=0;n