新增渲染接口
This commit is contained in:
@@ -95,6 +95,9 @@ module es {
|
||||
let component = this._components[i];
|
||||
if (!component) continue;
|
||||
|
||||
if (component instanceof RenderableComponent)
|
||||
this._entity.scene.renderableComponents.remove(component);
|
||||
|
||||
// 处理IUpdatable
|
||||
if (isIUpdatable(component))
|
||||
new es.List(this._updatableComponents).remove(component);
|
||||
@@ -109,6 +112,9 @@ module es {
|
||||
if (this._components.length > 0) {
|
||||
for (let i = 0, s = this._components.length; i < s; ++ i) {
|
||||
let component = this._components[i];
|
||||
if (component instanceof RenderableComponent)
|
||||
this._entity.scene.renderableComponents.remove(component);
|
||||
|
||||
if (isIUpdatable(component))
|
||||
this._updatableComponents.push(component);
|
||||
|
||||
@@ -151,6 +157,9 @@ module es {
|
||||
if (this._componentsToAddList.length > 0) {
|
||||
for (let i = 0, l = this._componentsToAddList.length; i < l; ++ i) {
|
||||
let component = this._componentsToAddList[i];
|
||||
if (component instanceof RenderableComponent)
|
||||
this._entity.scene.renderableComponents.add(component);
|
||||
|
||||
if (isIUpdatable(component))
|
||||
this._updatableComponents.push(component);
|
||||
|
||||
@@ -186,6 +195,9 @@ module es {
|
||||
}
|
||||
|
||||
public handleRemove(component: Component) {
|
||||
if (component instanceof RenderableComponent)
|
||||
this._entity.scene.renderableComponents.remove(component);
|
||||
|
||||
if (isIUpdatable(component) && this._updatableComponents.length > 0) {
|
||||
let index = this._updatableComponents.findIndex((c) => (<any>c as Component).id == component.id);
|
||||
if (index != -1)
|
||||
@@ -313,5 +325,13 @@ module es {
|
||||
this._components[i].onDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
public debugRender(batcher: IBatcher) {
|
||||
for (let i = 0; i < this._components.length; i ++) {
|
||||
if (this._components[i].enabled) {
|
||||
this._components[i].debugRender(batcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user