22 lines
459 B
JavaScript
22 lines
459 B
JavaScript
import {System} from '@/ecs/index.js';
|
|
|
|
export default class CalculateAabbs extends System {
|
|
|
|
tick() {
|
|
const {diff} = this.ecs;
|
|
for (const id in diff) {
|
|
if (diff[id].Position) {
|
|
const {Position: {x, y}, VisibleAabb} = this.ecs.get(id);
|
|
if (VisibleAabb) {
|
|
VisibleAabb.x0 = x - 32;
|
|
VisibleAabb.x1 = x + 32;
|
|
VisibleAabb.y0 = y - 32;
|
|
VisibleAabb.y1 = y + 32;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|