using Ghost.Entities.Components; using Ghost.Entities.Query; namespace Ghost.Entities; public readonly struct QueryItem where T0 : unmanaged, IComponentData { private readonly Entity _entity; private readonly ComponentPool _pool0; internal QueryItem(Entity entity, ComponentPool pool0) { _entity = entity; _pool0 = pool0; } public Entity Entity => _entity; public ref T0 Component0 => ref _pool0.GetRef(_entity); // Deconstruct into tuple-like values public void Deconstruct(out Entity entity, out CompRef c0) { entity = _entity; c0 = new(ref _pool0.GetRef(_entity)); } } public readonly struct QueryItem where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData { private readonly Entity _entity; private readonly ComponentPool _pool0; private readonly ComponentPool _pool1; internal QueryItem(Entity entity, ComponentPool pool0, ComponentPool pool1) { _entity = entity; _pool0 = pool0; _pool1 = pool1; } public Entity Entity => _entity; public ref T0 Component0 => ref _pool0.GetRef(_entity); public ref T1 Component1 => ref _pool1.GetRef(_entity); // Deconstruct into tuple-like values public void Deconstruct(out Entity entity, out CompRef c0, out CompRef c1) { entity = _entity; c0 = new(ref _pool0.GetRef(_entity)); c1 = new(ref _pool1.GetRef(_entity)); } } public readonly struct QueryItem where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData { private readonly Entity _entity; private readonly ComponentPool _pool0; private readonly ComponentPool _pool1; private readonly ComponentPool _pool2; internal QueryItem(Entity entity, ComponentPool pool0, ComponentPool pool1, ComponentPool pool2) { _entity = entity; _pool0 = pool0; _pool1 = pool1; _pool2 = pool2; } public Entity Entity => _entity; public ref T0 Component0 => ref _pool0.GetRef(_entity); public ref T1 Component1 => ref _pool1.GetRef(_entity); public ref T2 Component2 => ref _pool2.GetRef(_entity); // Deconstruct into tuple-like values public void Deconstruct(out Entity entity, out CompRef c0, out CompRef c1, out CompRef c2) { entity = _entity; c0 = new(ref _pool0.GetRef(_entity)); c1 = new(ref _pool1.GetRef(_entity)); c2 = new(ref _pool2.GetRef(_entity)); } } public readonly struct QueryItem where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData { private readonly Entity _entity; private readonly ComponentPool _pool0; private readonly ComponentPool _pool1; private readonly ComponentPool _pool2; private readonly ComponentPool _pool3; internal QueryItem(Entity entity, ComponentPool pool0, ComponentPool pool1, ComponentPool pool2, ComponentPool pool3) { _entity = entity; _pool0 = pool0; _pool1 = pool1; _pool2 = pool2; _pool3 = pool3; } public Entity Entity => _entity; public ref T0 Component0 => ref _pool0.GetRef(_entity); public ref T1 Component1 => ref _pool1.GetRef(_entity); public ref T2 Component2 => ref _pool2.GetRef(_entity); public ref T3 Component3 => ref _pool3.GetRef(_entity); // Deconstruct into tuple-like values public void Deconstruct(out Entity entity, out CompRef c0, out CompRef c1, out CompRef c2, out CompRef c3) { entity = _entity; c0 = new(ref _pool0.GetRef(_entity)); c1 = new(ref _pool1.GetRef(_entity)); c2 = new(ref _pool2.GetRef(_entity)); c3 = new(ref _pool3.GetRef(_entity)); } } public readonly struct QueryItem where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData where T4 : unmanaged, IComponentData { private readonly Entity _entity; private readonly ComponentPool _pool0; private readonly ComponentPool _pool1; private readonly ComponentPool _pool2; private readonly ComponentPool _pool3; private readonly ComponentPool _pool4; internal QueryItem(Entity entity, ComponentPool pool0, ComponentPool pool1, ComponentPool pool2, ComponentPool pool3, ComponentPool pool4) { _entity = entity; _pool0 = pool0; _pool1 = pool1; _pool2 = pool2; _pool3 = pool3; _pool4 = pool4; } public Entity Entity => _entity; public ref T0 Component0 => ref _pool0.GetRef(_entity); public ref T1 Component1 => ref _pool1.GetRef(_entity); public ref T2 Component2 => ref _pool2.GetRef(_entity); public ref T3 Component3 => ref _pool3.GetRef(_entity); public ref T4 Component4 => ref _pool4.GetRef(_entity); // Deconstruct into tuple-like values public void Deconstruct(out Entity entity, out CompRef c0, out CompRef c1, out CompRef c2, out CompRef c3, out CompRef c4) { entity = _entity; c0 = new(ref _pool0.GetRef(_entity)); c1 = new(ref _pool1.GetRef(_entity)); c2 = new(ref _pool2.GetRef(_entity)); c3 = new(ref _pool3.GetRef(_entity)); c4 = new(ref _pool4.GetRef(_entity)); } } public readonly struct QueryItem where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData where T4 : unmanaged, IComponentData where T5 : unmanaged, IComponentData { private readonly Entity _entity; private readonly ComponentPool _pool0; private readonly ComponentPool _pool1; private readonly ComponentPool _pool2; private readonly ComponentPool _pool3; private readonly ComponentPool _pool4; private readonly ComponentPool _pool5; internal QueryItem(Entity entity, ComponentPool pool0, ComponentPool pool1, ComponentPool pool2, ComponentPool pool3, ComponentPool pool4, ComponentPool pool5) { _entity = entity; _pool0 = pool0; _pool1 = pool1; _pool2 = pool2; _pool3 = pool3; _pool4 = pool4; _pool5 = pool5; } public Entity Entity => _entity; public ref T0 Component0 => ref _pool0.GetRef(_entity); public ref T1 Component1 => ref _pool1.GetRef(_entity); public ref T2 Component2 => ref _pool2.GetRef(_entity); public ref T3 Component3 => ref _pool3.GetRef(_entity); public ref T4 Component4 => ref _pool4.GetRef(_entity); public ref T5 Component5 => ref _pool5.GetRef(_entity); // Deconstruct into tuple-like values public void Deconstruct(out Entity entity, out CompRef c0, out CompRef c1, out CompRef c2, out CompRef c3, out CompRef c4, out CompRef c5) { entity = _entity; c0 = new(ref _pool0.GetRef(_entity)); c1 = new(ref _pool1.GetRef(_entity)); c2 = new(ref _pool2.GetRef(_entity)); c3 = new(ref _pool3.GetRef(_entity)); c4 = new(ref _pool4.GetRef(_entity)); c5 = new(ref _pool5.GetRef(_entity)); } } public readonly struct QueryItem where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData where T4 : unmanaged, IComponentData where T5 : unmanaged, IComponentData where T6 : unmanaged, IComponentData { private readonly Entity _entity; private readonly ComponentPool _pool0; private readonly ComponentPool _pool1; private readonly ComponentPool _pool2; private readonly ComponentPool _pool3; private readonly ComponentPool _pool4; private readonly ComponentPool _pool5; private readonly ComponentPool _pool6; internal QueryItem(Entity entity, ComponentPool pool0, ComponentPool pool1, ComponentPool pool2, ComponentPool pool3, ComponentPool pool4, ComponentPool pool5, ComponentPool pool6) { _entity = entity; _pool0 = pool0; _pool1 = pool1; _pool2 = pool2; _pool3 = pool3; _pool4 = pool4; _pool5 = pool5; _pool6 = pool6; } public Entity Entity => _entity; public ref T0 Component0 => ref _pool0.GetRef(_entity); public ref T1 Component1 => ref _pool1.GetRef(_entity); public ref T2 Component2 => ref _pool2.GetRef(_entity); public ref T3 Component3 => ref _pool3.GetRef(_entity); public ref T4 Component4 => ref _pool4.GetRef(_entity); public ref T5 Component5 => ref _pool5.GetRef(_entity); public ref T6 Component6 => ref _pool6.GetRef(_entity); // Deconstruct into tuple-like values public void Deconstruct(out Entity entity, out CompRef c0, out CompRef c1, out CompRef c2, out CompRef c3, out CompRef c4, out CompRef c5, out CompRef c6) { entity = _entity; c0 = new(ref _pool0.GetRef(_entity)); c1 = new(ref _pool1.GetRef(_entity)); c2 = new(ref _pool2.GetRef(_entity)); c3 = new(ref _pool3.GetRef(_entity)); c4 = new(ref _pool4.GetRef(_entity)); c5 = new(ref _pool5.GetRef(_entity)); c6 = new(ref _pool6.GetRef(_entity)); } } public readonly struct QueryItem where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData where T4 : unmanaged, IComponentData where T5 : unmanaged, IComponentData where T6 : unmanaged, IComponentData where T7 : unmanaged, IComponentData { private readonly Entity _entity; private readonly ComponentPool _pool0; private readonly ComponentPool _pool1; private readonly ComponentPool _pool2; private readonly ComponentPool _pool3; private readonly ComponentPool _pool4; private readonly ComponentPool _pool5; private readonly ComponentPool _pool6; private readonly ComponentPool _pool7; internal QueryItem(Entity entity, ComponentPool pool0, ComponentPool pool1, ComponentPool pool2, ComponentPool pool3, ComponentPool pool4, ComponentPool pool5, ComponentPool pool6, ComponentPool pool7) { _entity = entity; _pool0 = pool0; _pool1 = pool1; _pool2 = pool2; _pool3 = pool3; _pool4 = pool4; _pool5 = pool5; _pool6 = pool6; _pool7 = pool7; } public Entity Entity => _entity; public ref T0 Component0 => ref _pool0.GetRef(_entity); public ref T1 Component1 => ref _pool1.GetRef(_entity); public ref T2 Component2 => ref _pool2.GetRef(_entity); public ref T3 Component3 => ref _pool3.GetRef(_entity); public ref T4 Component4 => ref _pool4.GetRef(_entity); public ref T5 Component5 => ref _pool5.GetRef(_entity); public ref T6 Component6 => ref _pool6.GetRef(_entity); public ref T7 Component7 => ref _pool7.GetRef(_entity); // Deconstruct into tuple-like values public void Deconstruct(out Entity entity, out CompRef c0, out CompRef c1, out CompRef c2, out CompRef c3, out CompRef c4, out CompRef c5, out CompRef c6, out CompRef c7) { entity = _entity; c0 = new(ref _pool0.GetRef(_entity)); c1 = new(ref _pool1.GetRef(_entity)); c2 = new(ref _pool2.GetRef(_entity)); c3 = new(ref _pool3.GetRef(_entity)); c4 = new(ref _pool4.GetRef(_entity)); c5 = new(ref _pool5.GetRef(_entity)); c6 = new(ref _pool6.GetRef(_entity)); c7 = new(ref _pool7.GetRef(_entity)); } }