package ecs.systems;

import ecs.components.Ttl;
import ecs.core.Entity;
import ecs.core.System;

class TtlSystem extends System {
	public function new() {
		super(Ttl);
	}

	override function updateEntity(entity:Entity, dt:Float) {
		final ttl = entity.get(Ttl);

		if (ttl.ttl <= 0) {
			engine.remove(entity);
		} else {
			ttl.ttl -= dt;
		}
	}
}
