addde remove component method to entity

beta.r3js.org
polygonboutique 2016-11-30 10:46:25 +01:00
parent 61ed31e517
commit 2895b74b6c
1 changed files with 7 additions and 0 deletions

View File

@ -138,6 +138,13 @@ GameLib.D3.Entity.prototype.addComponent = function(
};
GameLib.D3.Entity.prototype.removeComponent = function(component) {
if(component && component.id && this.parentScene.idToComponent[component.id]) {
this.ids = this.ids.splice(this.ids.indexOf(component), 1);
delete this.parentScene.idToComponent[component.id];
}
};
GameLib.D3.Entity.prototype.getComponent = function(
componentType
) {