Add attribute system with core stats and gameplay components
This commit is contained in:
19
GameCore/Combat/DestructionSystem.cs
Normal file
19
GameCore/Combat/DestructionSystem.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user