19 lines
458 B
C#
19 lines
458 B
C#
using GameCore.ECS;
|
|
using GameCore.ECS.Interfaces;
|
|
using GameCore.Events;
|
|
|
|
namespace GameCore.Combat;
|
|
|
|
public class DestructionSystem : ISystem
|
|
{
|
|
public void Update(World world, float deltaTime)
|
|
{
|
|
var entitiesWithDeath = world.GetEntitiesWith<DeathComponent>();
|
|
foreach (var entity in entitiesWithDeath)
|
|
{
|
|
world.PublishEvent(new EntityDiedEvent(entity));
|
|
|
|
world.DestroyEntity(entity);
|
|
}
|
|
}
|
|
} |