fix: entitiy structure

This commit is contained in:
cha0s 2021-01-17 11:17:57 -06:00
parent 5f43591176
commit 7ddeea6efb

View File

@ -7,19 +7,19 @@ export default class EntityListView extends Container {
this.entityList = entityList;
entityList.on('entityAdded', this.onListEntityAdded, this);
entityList.on('entityRemoved', this.onListEntityRemoved, this);
for (let i = 0; i < entityList.entities.length; i++) {
this.onListEntityAdded(entityList.entities[i]);
}
Object.values(entityList.entities).forEach((entity) => {
this.onListEntityAdded(entity);
});
}
onListEntityAdded(entity) {
if (entity.is('visible')) {
if (entity.is('Visible')) {
this.addChild(entity.container);
}
}
onListEntityRemoved(entity) {
if (entity.is('visible')) {
if (entity.is('Visible')) {
this.removeChild(entity.container);
}
}