namespace DCFApixels.DragonECS { public interface IEcsLateRunSystem : IEcsSystem { public void LateRun(EcsPipeline pipeline); } public class EcsLateRunSystemRunner : EcsRunner, IEcsLateRunSystem { #if DEBUG && !DISABLE_DRAGONECS_DEBUG private EcsProfilerMarker[] _markers; #endif public void LateRun(EcsPipeline pipeline) { #if DEBUG && !DISABLE_DRAGONECS_DEBUG for (int i = 0; i < targets.Length; i++) { using (_markers[i].Auto()) targets[i].LateRun(pipeline); } #else foreach (var item in targets) item.LateRun(pipeline); #endif } #if DEBUG && !DISABLE_DRAGONECS_DEBUG protected override void OnSetup() { _markers = new EcsProfilerMarker[targets.Length]; for (int i = 0; i < targets.Length; i++) { _markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(LateRun)}")); } } #endif } public static class IEcsLateRunSystemExtensions { public static void LateRun(this EcsPipeline systems) { systems.GetRunner().LateRun(systems); } } public interface IEcsFixedRunSystem : IEcsSystem { public void FixedRun(EcsPipeline pipeline); } public class EcsFixedRunSystemRunner : EcsRunner, IEcsFixedRunSystem { #if DEBUG && !DISABLE_DRAGONECS_DEBUG private EcsProfilerMarker[] _markers; #endif public void FixedRun(EcsPipeline pipeline) { #if DEBUG && !DISABLE_DRAGONECS_DEBUG for (int i = 0; i < targets.Length; i++) { using (_markers[i].Auto()) targets[i].FixedRun(pipeline); } #else foreach (var item in targets) item.FixedRun(pipeline); #endif } #if DEBUG && !DISABLE_DRAGONECS_DEBUG protected override void OnSetup() { _markers = new EcsProfilerMarker[targets.Length]; for (int i = 0; i < targets.Length; i++) { _markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(FixedRun)}")); } } #endif } public static class IEcsFixedRunSystemExtensions { public static void FixedRun(this EcsPipeline pipeline) { pipeline.GetRunner().FixedRun(pipeline); } } }