This commit is contained in:
yhh
2021-01-05 09:41:40 +08:00
parent cadaeda3bf
commit 6699c32f73
10 changed files with 100 additions and 85 deletions

View File

@@ -82,6 +82,9 @@ module es {
for (let component of this._components) {
if (!component) continue;
if (component instanceof RenderableComponent)
new linq.List(this._entity.scene.renderableComponents.buffer).remove(component);
// 处理IUpdatable
if (isIUpdatable(component))
new linq.List(this._updatableComponents).remove(component);
@@ -93,6 +96,9 @@ module es {
public registerAllComponents() {
for (let component of this._components) {
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.buffer.push(component);
if (isIUpdatable(component))
this._updatableComponents.push(component);
@@ -118,6 +124,9 @@ module es {
for (let i = 0, count = this._componentsToAdd.length; i < count; i++) {
let component = this._componentsToAdd[i];
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.buffer.push(component);
if (isIUpdatable(component))
this._updatableComponents.push(component);
@@ -153,7 +162,8 @@ module es {
}
public handleRemove(component: Component) {
if (!component) return;
if (component instanceof RenderableComponent)
new linq.List(this._entity.scene.renderableComponents.buffer).remove(component);
if (isIUpdatable(component))
new linq.List(this._updatableComponents).remove(component);

View File

@@ -19,6 +19,10 @@ module es {
return this._components.length;
}
public get buffer(){
return this._components;
}
public get(index: number): IRenderable {
return this._components[index];
}