import { System, SystemNames } from "."; import { Game } from ".."; import { Life as LifeComponent, ComponentNames } from "../components"; export class Life extends System { constructor() { super(SystemNames.Life); } public update(_dt: number, game: Game) { game.forEachEntityWithComponent(ComponentNames.Life, (entity) => { const life = entity.getComponent(ComponentNames.Life); if (!life.alive) { game.removeEntity(entity.id); } }); } }