namespace DCFApixels.DragonECS { public abstract partial class EcsWorld { internal readonly struct PoolCache : IEcsWorldComponent> where T : IEcsPoolImplementation, new() { public readonly T instance; public PoolCache(T instance) => this.instance = instance; void IEcsWorldComponent>.Init(ref PoolCache component, EcsWorld world) { component = new PoolCache(world.CreatePool()); } void IEcsWorldComponent>.OnDestroy(ref PoolCache component, EcsWorld world) { component = default; } } internal readonly struct AspectCache : IEcsWorldComponent> where T : EcsAspect { public readonly T instance; public AspectCache(T instance) => this.instance = instance; void IEcsWorldComponent>.Init(ref AspectCache component, EcsWorld world) { component = new AspectCache(EcsAspect.Builder.Build(world)); } void IEcsWorldComponent>.OnDestroy(ref AspectCache component, EcsWorld world) { component = default; } } internal readonly struct ExcecutorCache : IEcsWorldComponent> where T : EcsQueryExecutor, new() { public readonly T instance; public ExcecutorCache(T instance) => this.instance = instance; void IEcsWorldComponent>.Init(ref ExcecutorCache component, EcsWorld world) { T instance = new T(); instance.Initialize(world); component = new ExcecutorCache(instance); } void IEcsWorldComponent>.OnDestroy(ref ExcecutorCache component, EcsWorld world) { component = default; } } } }