using System.Collections.Generic; namespace DCFApixels.DragonECS { [DebugColor(DebugColor.Black)] public class SystemsBlockMarkerSystem : IEcsSystem { public readonly string name; public SystemsBlockMarkerSystem(string name) { this.name = name; } } [DebugHide, DebugColor(DebugColor.Grey)] public class DeleteEmptyEntitesSsytem : IEcsRunSystem, IEcsPreInject { private List _worlds = new List(); public void PreInject(object obj) { if (obj is EcsWorld world) _worlds.Add(world); } public void Run(EcsPipeline pipeline) { foreach (var world in _worlds) world.DeleteEmptyEntites(); } } public class DeleteOneFrameComponentSystem : IEcsRunSystem, IEcsInject where TWorld : EcsWorld where TComponent : struct, IEcsComponent { private TWorld _world; public void Inject(TWorld obj) => _world = obj; private sealed class Query : EcsQuery { public EcsPool pool; public Query(Builder b) { pool = b.Include(); } } public void Run(EcsPipeline pipeline) { foreach (var e in _world.Where(out Query q)) q.pool.Del(e); } } public static class DeleteOneFrameComponentSystemExt { public static EcsPipeline.Builder AutoDel(this EcsPipeline.Builder b) where TWorld : EcsWorld where TComponent : struct, IEcsComponent { b.Add(new DeleteOneFrameComponentSystem()); return b; } /// for EcsDefaultWorld public static EcsPipeline.Builder AutoDel(this EcsPipeline.Builder b) where TComponent : struct, IEcsComponent { b.Add(new DeleteOneFrameComponentSystem()); return b; } } }