refactor: simple
This commit is contained in:
parent
e033d6e79a
commit
f2445648c4
|
@ -12,7 +12,7 @@ export default class CalculateAabbs extends System {
|
||||||
const {diff} = this.ecs;
|
const {diff} = this.ecs;
|
||||||
for (const id in diff) {
|
for (const id in diff) {
|
||||||
if (diff[id].Position) {
|
if (diff[id].Position) {
|
||||||
const {Position: {x, y}, VisibleAabb} = this.ecs.get(parseInt(id))
|
const {Position: {x, y}, VisibleAabb} = this.ecs.get(id);
|
||||||
if (VisibleAabb) {
|
if (VisibleAabb) {
|
||||||
VisibleAabb.x0 = x - 32;
|
VisibleAabb.x0 = x - 32;
|
||||||
VisibleAabb.x1 = x + 32;
|
VisibleAabb.x1 = x + 32;
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default class FollowCamera extends System {
|
||||||
reindex(entities) {
|
reindex(entities) {
|
||||||
super.reindex(entities);
|
super.reindex(entities);
|
||||||
for (const id of entities) {
|
for (const id of entities) {
|
||||||
this.updateCamera(this.ecs.get(parseInt(id)));
|
this.updateCamera(this.ecs.get(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ export default class FollowCamera extends System {
|
||||||
const {diff} = this.ecs;
|
const {diff} = this.ecs;
|
||||||
for (const id in diff) {
|
for (const id in diff) {
|
||||||
if (diff[id].Position) {
|
if (diff[id].Position) {
|
||||||
this.updateCamera(this.ecs.get(parseInt(id)));
|
this.updateCamera(this.ecs.get(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ export default class UpdateSpatialHash extends System {
|
||||||
const {diff} = this.ecs;
|
const {diff} = this.ecs;
|
||||||
for (const id in diff) {
|
for (const id in diff) {
|
||||||
if (diff[id].VisibleAabb) {
|
if (diff[id].VisibleAabb) {
|
||||||
this.updateHash(this.ecs.get(parseInt(id)));
|
this.updateHash(this.ecs.get(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ export default function EcsComponent() {
|
||||||
delete updatedEntities[id];
|
delete updatedEntities[id];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
updatedEntities[id] = ecs.get(parseInt(id));
|
updatedEntities[id] = ecs.get(id);
|
||||||
if (updatedEntities[id].MainEntity) {
|
if (updatedEntities[id].MainEntity) {
|
||||||
setMainEntity(ecs.get(parseInt(id)));
|
setMainEntity(ecs.get(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user