为boxCollider与spriteRenderer新增debugRender

This commit is contained in:
YHH
2020-08-24 09:06:25 +08:00
parent 7345a17d24
commit 27f9e78fe5
19 changed files with 699 additions and 421 deletions

View File

@@ -77,10 +77,13 @@ module es {
// 处理渲染层列表
if (component instanceof RenderableComponent) {
this._entity.scene.removeChild(component.displayObject);
if (component.displayObject.parent)
component.displayObject.parent.removeChild(component.displayObject);
this._entity.scene.renderableComponents.remove(component);
}
if (component.debugDisplayObject.parent)
component.debugDisplayObject.parent.removeChild(component.debugDisplayObject);
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component), false);
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);
@@ -96,6 +99,7 @@ module es {
this._entity.scene.renderableComponents.add(component);
}
this._entity.scene.addChild(component.debugDisplayObject);
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component));
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
}
@@ -122,7 +126,7 @@ module es {
this._entity.scene.renderableComponents.add(component);
}
this._entity.scene.addChild(component.debugDisplayObject);
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component));
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
@@ -162,7 +166,8 @@ module es {
this._entity.scene.renderableComponents.remove(component);
}
if (component.debugDisplayObject.parent)
component.debugDisplayObject.parent.removeChild(component.debugDisplayObject);
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component), false);
this._entity.scene.entityProcessors.onComponentRemoved(this._entity);