2D-Platformer/Assets/Scripts/AI/GoapActionDeleteSystem.cs
2022-02-12 12:53:50 +02:00

21 lines
No EOL
458 B
C#

using DefaultNamespace;
using Unity.Entities;
namespace AI
{
[UpdateInGroup(typeof(LateSimulationSystemGroup)), UpdateAfter(typeof(EntityDeathSystem))]
public class GoapActionDeleteSystem : ComponentSystem
{
protected override void OnUpdate()
{
Entities.ForEach(
(Entity entity, ref GoapActionActor action) =>
{
if (!EntityManager.Exists(action.Actor))
{
PostUpdateCommands.DestroyEntity(entity);
}
});
}
}
}