ECS refactor: new ComponentSet, serialization, generators

Major ECS API overhaul: added ComponentSet, refactored ComponentRegistry, and updated all entity/component creation methods. Introduced robust custom serialization infrastructure and per-component source generators for registration and (de)serialization. Updated editor, engine, and test code to use new APIs. Improved code quality, naming, and performance throughout. Removed obsolete code and updated dependencies.
This commit is contained in:
2025-12-20 20:41:40 +09:00
parent 3118021272
commit 00b4e82ded
60 changed files with 1216 additions and 814 deletions

View File

@@ -74,7 +74,7 @@ internal unsafe sealed class ChunkDebugView
var it = archetype._signature.GetIterator();
while (it.Next(out var index))
{
var type = ComponentRegister.s_runtimeIDToType[index];
var type = ComponentRegistry.s_runtimeIDToType[index];
if (type == null)
{
continue;
@@ -238,7 +238,7 @@ internal unsafe struct Archetype : IDisposable
for (var i = 0; i < componentIds.Length; i++)
{
_signature.SetBit(componentIds[i]);
components[i] = ComponentRegister.GetComponentInfo(componentIds[i]);
components[i] = ComponentRegistry.GetComponentInfo(componentIds[i]);
}
// Calculate total size per entity to get an initial capacity estimate
@@ -394,7 +394,7 @@ internal unsafe struct Archetype : IDisposable
ref var chunk = ref _chunks[chunkIndex];
var chunkBase = chunk.GetUnsafePtr();
var size = ComponentRegister.GetComponentInfo(componentID).size;
var size = ComponentRegistry.GetComponentInfo(componentID).size;
var dst = chunkBase + offset + (size * rowIndex);
MemoryUtility.MemCpy(dst, pComponent, (nuint)size);
@@ -418,7 +418,7 @@ internal unsafe struct Archetype : IDisposable
var chunk = _chunks[chunkIndex];
var chunkBase = chunk.GetUnsafePtr();
var size = ComponentRegister.GetComponentInfo(componentID).size;
var size = ComponentRegistry.GetComponentInfo(componentID).size;
return chunkBase + offset + (size * rowIndex);
}

View File

@@ -1,4 +1,5 @@
using Ghost.Core;
using Misaki.HighPerformance.LowLevel.Buffer;
using Misaki.HighPerformance.LowLevel.Collections;
using Misaki.HighPerformance.LowLevel.Utilities;
using System.Runtime.CompilerServices;
@@ -16,26 +17,88 @@ public interface IEnableableComponent : IComponent
internal struct ComponentInfo
{
// public string stableName; // Do we actually need this?
public int id;
public Identifier<IComponent> id;
public int size;
public int alignment;
public bool isEnableable;
}
/// <summary>
/// Represents an immutable set of component identifiers used to define a group of components within an entity or system.
/// </summary>
public struct ComponentSet : IDisposable, IEquatable<ComponentSet>
{
private UnsafeArray<Identifier<IComponent>> _components;
private int _hashCode;
public readonly ReadOnlySpan<Identifier<IComponent>> Components => _components.AsSpan();
public ComponentSet(AllocationHandle allocationHandle, params ReadOnlySpan<Identifier<IComponent>> components)
{
_components = new UnsafeArray<Identifier<IComponent>>(components.Length, allocationHandle);
components.CopyTo(_components.AsSpan());
_hashCode = -1;
}
public ComponentSet(Allocator allocator, params ReadOnlySpan<Identifier<IComponent>> components)
: this(AllocationManager.GetAllocationHandle(allocator), components)
{
}
public readonly bool Equals(ComponentSet other)
{
return _hashCode == other._hashCode;
}
public override int GetHashCode()
{
if (_hashCode == -1)
{
_hashCode = ComponentRegistry.GetHashCode(_components.AsSpan());
}
return _hashCode;
}
public override bool Equals(object? obj)
{
return obj is ComponentSet set && Equals(set);
}
public static bool operator ==(ComponentSet left, ComponentSet right)
{
return left.Equals(right);
}
public static bool operator !=(ComponentSet left, ComponentSet right)
{
return !(left == right);
}
public void Dispose()
{
_components.Dispose();
}
}
/// <summary>
/// Provides a unique identifier for the specified unmanaged component type.
/// </summary>
/// <typeparam name="T">The component type for which to obtain an identifier. Must be unmanaged and implement <see cref="IComponent"/>.</typeparam>
public static class ComponentTypeID<T>
where T : unmanaged, IComponent
{
public static readonly Identifier<IComponent> value = ComponentRegister.GetOrRegisterComponent<T>();
public static readonly Identifier<IComponent> Value = ComponentRegistry.GetOrRegisterComponent<T>();
}
internal static class ComponentRegister
internal static class ComponentRegistry
{
private static readonly List<ComponentInfo> s_registeredComponents = new();
private static readonly Dictionary<IntPtr, int> s_typeHandleToID = new();
private static readonly Dictionary<string, int> s_nameToRuntimeID = new();
#if DEBUG || GHOST_EDITOR
internal static readonly Dictionary<int, Type> s_runtimeIDToType = new();
#endif
public static unsafe Identifier<IComponent> GetOrRegisterComponent<T>()
where T : unmanaged, IComponent
@@ -66,9 +129,7 @@ internal static class ComponentRegister
s_typeHandleToID[typeHandle] = newID;
s_nameToRuntimeID[stableName] = newID;
#if DEBUG || GHOST_EDITOR
s_runtimeIDToType[newID.value] = typeof(T);
#endif
return newID;
}
@@ -98,7 +159,21 @@ internal static class ComponentRegister
}
}
// TODO: A ComponentSet structure to cache the hashcode for better performance.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ComponentInfo GetComponentInfo(Type type)
{
lock (s_registeredComponents)
{
var typeId = GetComponentID(type);
if (typeId.IsInvalid)
{
throw new KeyNotFoundException($"Component type {type.FullName} is not registered.");
}
return s_registeredComponents[typeId];
}
}
public static int GetHashCode(params ReadOnlySpan<Identifier<IComponent>> componentTypeIDs)
{
var largestID = 0;

View File

@@ -108,12 +108,12 @@ public unsafe class EntityCommandBuffer : IDisposable
Write(count);
}
public void CreateEntity(int count, params ReadOnlySpan<Identifier<IComponent>> componentTypeIDs)
public void CreateEntity(int count, ComponentSet set)
{
WriteHeader(ECBOpCode.CreateEntityWithComponents);
Write(count);
Write(componentTypeIDs.Length);
WriteSpan(componentTypeIDs);
Write(set.Components.Length);
WriteSpan(set.Components);
}
public void DestroyEntity(Entity entity)
@@ -127,7 +127,7 @@ public unsafe class EntityCommandBuffer : IDisposable
{
WriteHeader(ECBOpCode.AddComponent);
Write(entity);
Write(ComponentTypeID<T>.value);
Write(ComponentTypeID<T>.Value);
Write(component);
}
@@ -136,7 +136,7 @@ public unsafe class EntityCommandBuffer : IDisposable
{
WriteHeader(ECBOpCode.RemoveComponent);
Write(entity);
Write(ComponentTypeID<T>.value);
Write(ComponentTypeID<T>.Value);
}
public void SetComponent<T>(Entity entity, T component)
@@ -144,7 +144,7 @@ public unsafe class EntityCommandBuffer : IDisposable
{
WriteHeader(ECBOpCode.SetComponent);
Write(entity);
Write(ComponentTypeID<T>.value);
Write(ComponentTypeID<T>.Value);
Write(component);
}
@@ -157,6 +157,8 @@ public unsafe class EntityCommandBuffer : IDisposable
{
var op = Read<ECBOpCode>(ref cursor);
using var scope = AllocationManager.CreateStackScope();
switch (op)
{
case ECBOpCode.CreateEntity:
@@ -168,7 +170,8 @@ public unsafe class EntityCommandBuffer : IDisposable
var entityCount = Read<int>(ref cursor);
var compCount = Read<int>(ref cursor);
var compTypeIDs = ReadSpan<Identifier<IComponent>>(ref cursor, compCount);
_entityManager.CreateEntities(entityCount, compTypeIDs);
var set = new ComponentSet(scope.AllocationHandle, compTypeIDs);
_entityManager.CreateEntities(entityCount, set);
break;
case ECBOpCode.DestroyEntity:
@@ -179,7 +182,7 @@ public unsafe class EntityCommandBuffer : IDisposable
case ECBOpCode.AddComponent:
var entityToAdd = Read<Entity>(ref cursor);
var addCompTypeID = Read<Identifier<IComponent>>(ref cursor);
var pAddCompData = ReadBuffer(ref cursor, ComponentRegister.GetComponentInfo(addCompTypeID).size);
var pAddCompData = ReadBuffer(ref cursor, ComponentRegistry.GetComponentInfo(addCompTypeID).size);
_entityManager.AddComponent(entityToAdd, addCompTypeID, pAddCompData);
break;
@@ -192,7 +195,7 @@ public unsafe class EntityCommandBuffer : IDisposable
case ECBOpCode.SetComponent:
var entityToSet = Read<Entity>(ref cursor);
var setCompTypeID = Read<Identifier<IComponent>>(ref cursor);
var pSetCompData = ReadBuffer(ref cursor, ComponentRegister.GetComponentInfo(setCompTypeID).size);
var pSetCompData = ReadBuffer(ref cursor, ComponentRegistry.GetComponentInfo(setCompTypeID).size);
_entityManager.SetComponent(entityToSet, setCompTypeID, pSetCompData);
break;
}

View File

@@ -110,7 +110,7 @@ public partial class EntityManager
var location = _entityLocations.GetElementAt(entity.ID, entity.Generation);
ref var archetype = ref _world.GetArchetypeReference(location.archetypeID);
var pManagedEntityRef = (ManagedEntityRef*)archetype.GetComponentData(location.chunkIndex, location.rowIndex, ComponentTypeID<ManagedEntityRef>.value);
var pManagedEntityRef = (ManagedEntityRef*)archetype.GetComponentData(location.chunkIndex, location.rowIndex, ComponentTypeID<ManagedEntityRef>.Value);
if (pManagedEntityRef == null)
{
throw new InvalidOperationException($"Entity {entity} does not have ManagedEntityRef component.");

View File

@@ -7,6 +7,30 @@ using System.Diagnostics;
namespace Ghost.Entities;
internal struct EntityLocation : IComparable<EntityLocation>
{
public int archetypeID;
public int chunkIndex;
public int rowIndex;
public readonly int CompareTo(EntityLocation other)
{
var archComp = chunkIndex.CompareTo(other.chunkIndex);
if (archComp != 0)
{
return archComp;
}
var chunkComp = chunkIndex.CompareTo(other.chunkIndex);
if (chunkComp != 0)
{
return chunkComp;
}
return rowIndex.CompareTo(other.rowIndex);
}
}
/// <summary>
/// A manager for creating, destroying, and managing entities and their components.
/// </summary>
@@ -17,34 +41,12 @@ namespace Ghost.Entities;
/// </remarks>
public unsafe partial class EntityManager : IDisposable
{
private struct EntityLocation : IComparable<EntityLocation>
{
public int archetypeID;
public int chunkIndex;
public int rowIndex;
public readonly int CompareTo(EntityLocation other)
{
var archComp = chunkIndex.CompareTo(other.chunkIndex);
if (archComp != 0)
{
return archComp;
}
var chunkComp = chunkIndex.CompareTo(other.chunkIndex);
if (chunkComp != 0)
{
return chunkComp;
}
return rowIndex.CompareTo(other.rowIndex);
}
}
private readonly World _world;
private UnsafeSlotMap<EntityLocation> _entityLocations;
private bool _disposed;
public World World => _world;
internal EntityManager(World world, int initialCapacity)
{
_world = world;
@@ -73,6 +75,16 @@ public unsafe partial class EntityManager : IDisposable
return ErrorStatus.None;
}
internal Result<EntityLocation, ErrorStatus> GetEntityLocation(Entity entity)
{
if (_entityLocations.TryGetElementAt(entity.ID, entity.Generation, out var location))
{
return location;
}
return ErrorStatus.NotFound;
}
/// <summary>
/// Create an entity with no components.
/// </summary>
@@ -88,12 +100,12 @@ public unsafe partial class EntityManager : IDisposable
/// <summary>
/// Create an entity with specified components.
/// </summary>
/// <param name="componentTypeIDs">The component type IDs to add to the entity.</param>
/// <param name="set">A set of component type IDs to add to the entities.</param>
/// <returns>The created entity.</returns>
public Entity CreateEntity(params ReadOnlySpan<Identifier<IComponent>> componentTypeIDs)
public Entity CreateEntity(ComponentSet set)
{
var entities = (Span<Entity>)stackalloc Entity[1];
CreateEntities(entities, componentTypeIDs);
CreateEntities(entities, set);
return entities[0];
}
@@ -150,16 +162,15 @@ public unsafe partial class EntityManager : IDisposable
/// Create multiple entities with specified components.
/// </summary>
/// <param name="allocator">The allocator to use for the returned array.</param>
/// <param name="componentTypeIDs">The component type IDs to add to the entities. </param>
/// <param name="set">A set of component type IDs to add to the entities.</param>
/// <returns>An array of the created entities.</returns>
public void CreateEntities(Span<Entity> entities, params ReadOnlySpan<Identifier<IComponent>> componentTypeIDs)
public void CreateEntities(Span<Entity> entities, ComponentSet set)
{
var signatureHash = ComponentRegister.GetHashCode(componentTypeIDs);
var arcID = _world.GetArchetypeIDBySignatureHash(signatureHash);
var arcID = _world.GetArchetypeIDBySignatureHash(set.GetHashCode());
if (arcID.IsNotValid)
if (arcID.IsInvalid)
{
arcID = _world.CreateArchetype(componentTypeIDs, signatureHash);
arcID = _world.CreateArchetype(set.Components, set.GetHashCode());
}
ref var archetype = ref _world.GetArchetypeReference(arcID);
@@ -186,15 +197,15 @@ public unsafe partial class EntityManager : IDisposable
/// Create multiple entities with specified components.
/// </summary>
/// <param name="count">The number of entities to create.</param>
/// <param name="componentTypeIDs">The component type IDs to add to the entities. </param>
public void CreateEntities(int count, params ReadOnlySpan<Identifier<IComponent>> componentTypeIDs)
/// <param name="set">A set of component type IDs to add to the entities.</param>
public void CreateEntities(int count, ComponentSet set)
{
var signatureHash = ComponentRegister.GetHashCode(componentTypeIDs);
var arcID = _world.GetArchetypeIDBySignatureHash(signatureHash);
var hash = set.GetHashCode();
var arcID = _world.GetArchetypeIDBySignatureHash(hash);
if (arcID.IsNotValid)
if (arcID.IsInvalid)
{
arcID = _world.CreateArchetype(componentTypeIDs, signatureHash);
arcID = _world.CreateArchetype(set.Components, hash);
}
ref var archetype = ref _world.GetArchetypeReference(arcID);
@@ -217,7 +228,7 @@ public unsafe partial class EntityManager : IDisposable
private void DestoryManagedEntityIfExists(ref readonly Archetype archetype, EntityLocation location)
{
var pManagedRef = archetype.GetComponentData(location.chunkIndex, location.rowIndex, ComponentTypeID<ManagedEntityRef>.value);
var pManagedRef = archetype.GetComponentData(location.chunkIndex, location.rowIndex, ComponentTypeID<ManagedEntityRef>.Value);
if (pManagedRef != null)
{
DestroyManagedEntity(((ManagedEntityRef*)pManagedRef)->entity);
@@ -260,7 +271,7 @@ public unsafe partial class EntityManager : IDisposable
{
void RemoveManagedEntity(ReadOnlySpan<int> rowIndicesCache, ref readonly Archetype archetype, int chunkIndex)
{
for (int j = 0; j < rowIndicesCache.Length; j++)
for (var j = 0; j < rowIndicesCache.Length; j++)
{
var rowIndex = rowIndicesCache[j];
var location = new EntityLocation
@@ -285,7 +296,7 @@ public unsafe partial class EntityManager : IDisposable
// 1. GATHER
// Resolve all entities to their locations
for (int i = 0; i < entities.Length; i++)
for (var i = 0; i < entities.Length; i++)
{
var entity = entities[i];
if (_entityLocations.TryGetElementAt(entity.ID, entity.Generation, out var location))
@@ -309,12 +320,12 @@ public unsafe partial class EntityManager : IDisposable
var prevArchetypeID = firstLoc.archetypeID;
var prevChunkIndex = firstLoc.chunkIndex;
for (int i = 0; i < batchDestroy.Count; i++)
for (var i = 0; i < batchDestroy.Count; i++)
{
var loc = batchDestroy[i];
// Check if we have crossed a boundary (Different Chunk OR Different Archetype)
bool isNewBatch = (loc.chunkIndex != prevChunkIndex) || (loc.archetypeID != prevArchetypeID);
var isNewBatch = (loc.chunkIndex != prevChunkIndex) || (loc.archetypeID != prevArchetypeID);
if (isNewBatch)
{
@@ -348,7 +359,7 @@ public unsafe partial class EntityManager : IDisposable
}
// 5. Remove from Entity Locations
for (int i = 0; i < entities.Length; i++)
for (var i = 0; i < entities.Length; i++)
{
var entity = entities[i];
_entityLocations.Remove(entity.ID, entity.Generation);
@@ -379,7 +390,7 @@ public unsafe partial class EntityManager : IDisposable
}
// Check if singleton already exists
var signatureHash = ComponentRegister.GetHashCode(componentID);
var signatureHash = ComponentRegistry.GetHashCode(componentID);
var arcID = _world.GetArchetypeIDBySignatureHash(signatureHash);
if (arcID.IsValid)
@@ -415,7 +426,7 @@ public unsafe partial class EntityManager : IDisposable
public ErrorStatus CreateSingleton<T>(T component = default)
where T : unmanaged, IComponent
{
return CreateSingleton(ComponentTypeID<T>.value, &component);
return CreateSingleton(ComponentTypeID<T>.Value, &component);
}
/// <summary>
@@ -425,10 +436,10 @@ public unsafe partial class EntityManager : IDisposable
/// <returns>Pointer to the component data, or null if not found.</returns>
public void* GetSingleton(Identifier<IComponent> componentID)
{
var signatureHash = ComponentRegister.GetHashCode(componentID);
var signatureHash = ComponentRegistry.GetHashCode(componentID);
var arcID = _world.GetArchetypeIDBySignatureHash(signatureHash);
if (arcID.IsNotValid)
if (arcID.IsInvalid)
{
return null;
}
@@ -454,7 +465,7 @@ public unsafe partial class EntityManager : IDisposable
public ref T GetSingleton<T>()
where T : unmanaged, IComponent
{
var ptr = GetSingleton(ComponentTypeID<T>.value);
var ptr = GetSingleton(ComponentTypeID<T>.Value);
return ref *(T*)ptr; // This will return null ref if ptr is null.
}
@@ -508,7 +519,7 @@ public unsafe partial class EntityManager : IDisposable
}
var newArcID = oldArchetype.GetEdgeAdd(componentID);
if (newArcID.IsNotValid)
if (newArcID.IsInvalid)
{
var largestComponentID = Math.Max(oldSignature.Count, componentID);
var length = UnsafeBitSet.RequiredLength(largestComponentID + 1);
@@ -532,7 +543,7 @@ public unsafe partial class EntityManager : IDisposable
// Find or create new archetype
var newSignatureHash = newSignature.GetHashCode();
newArcID = _world.GetArchetypeIDBySignatureHash(newSignatureHash);
if (newArcID.IsNotValid)
if (newArcID.IsInvalid)
{
// Create new archetype
Span<Identifier<IComponent>> componentTypeIDs = stackalloc Identifier<IComponent>[compCount];
@@ -584,7 +595,7 @@ public unsafe partial class EntityManager : IDisposable
public ErrorStatus AddComponent<T>(Entity entity, T component = default)
where T : unmanaged, IComponent
{
return AddComponent(entity, ComponentTypeID<T>.value, &component);
return AddComponent(entity, ComponentTypeID<T>.Value, &component);
}
/// <summary>
@@ -607,7 +618,7 @@ public unsafe partial class EntityManager : IDisposable
var oldSignature = oldArchetype._signature;
var newArcID = oldArchetype.GetEdgeRemove(componentID);
if (newArcID.IsNotValid)
if (newArcID.IsInvalid)
{
var largestComponentID = Math.Max(oldSignature.Count, componentID);
var length = UnsafeBitSet.RequiredLength(largestComponentID + 1);
@@ -631,7 +642,7 @@ public unsafe partial class EntityManager : IDisposable
// Find or create new archetype
var newSignatureHash = newSignature.GetHashCode();
newArcID = _world.GetArchetypeIDBySignatureHash(newSignatureHash);
if (newArcID.IsNotValid)
if (newArcID.IsInvalid)
{
// Create new archetype
Span<Identifier<IComponent>> componentTypeIDs = stackalloc Identifier<IComponent>[compCount];
@@ -664,7 +675,7 @@ public unsafe partial class EntityManager : IDisposable
return r;
}
var pManagedRef = oldArchetype.GetComponentData(location.chunkIndex, location.rowIndex, ComponentTypeID<ManagedEntityRef>.value);
var pManagedRef = oldArchetype.GetComponentData(location.chunkIndex, location.rowIndex, ComponentTypeID<ManagedEntityRef>.Value);
if (pManagedRef != null)
{
DestroyManagedEntity(((ManagedEntityRef*)pManagedRef)->entity);
@@ -687,7 +698,7 @@ public unsafe partial class EntityManager : IDisposable
public ErrorStatus RemoveComponent<T>(Entity entity)
where T : unmanaged, IComponent
{
return RemoveComponent(entity, ComponentTypeID<T>.value);
return RemoveComponent(entity, ComponentTypeID<T>.Value);
}
/// <summary>
@@ -719,7 +730,7 @@ public unsafe partial class EntityManager : IDisposable
public ErrorStatus SetComponent<T>(Entity entity, T component)
where T : unmanaged, IComponent
{
return SetComponent(entity, ComponentTypeID<T>.value, &component);
return SetComponent(entity, ComponentTypeID<T>.Value, &component);
}
/// <summary>
@@ -748,7 +759,7 @@ public unsafe partial class EntityManager : IDisposable
public ref T GetComponent<T>(Entity entity)
where T : unmanaged, IComponent
{
var ptr = GetComponent(entity, ComponentTypeID<T>.value);
var ptr = GetComponent(entity, ComponentTypeID<T>.Value);
return ref *(T*)ptr; // This will return null ref if ptr is null.
}
@@ -778,7 +789,7 @@ public unsafe partial class EntityManager : IDisposable
public bool HasComponent<T>(Entity entity)
where T : unmanaged, IComponent
{
return HasComponent(entity, ComponentTypeID<T>.value);
return HasComponent(entity, ComponentTypeID<T>.Value);
}
/// <summary>
@@ -834,7 +845,7 @@ public unsafe partial class EntityManager : IDisposable
public ErrorStatus SetEnabled<T>(Entity entity, bool enabled)
where T : unmanaged, IEnableableComponent
{
return SetEnabled(entity, ComponentTypeID<T>.value, enabled);
return SetEnabled(entity, ComponentTypeID<T>.Value, enabled);
}
public void Dispose()

View File

@@ -17,10 +17,6 @@
<IsTrimmable>True</IsTrimmable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Templates\ForEach.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Templates\EntityQuery.ForEach.gen.cs">
<DesignTime>True</DesignTime>

View File

@@ -24,7 +24,7 @@ public readonly struct Managed<T> : IComponent, IManagedWrapper
public static class ManagedComponemtnID<T>
where T : IManagedComponent
{
public static readonly Identifier<IManagedComponent> value = ManagedComponentRegister.GetOrRegisterComponent<T>();
public static readonly Identifier<IManagedComponent> value = ManagedComponentRegistry.GetOrRegisterComponent<T>();
}
internal struct ManagedComponentInfo
@@ -33,7 +33,7 @@ internal struct ManagedComponentInfo
public bool isScriptComponent;
}
internal static class ManagedComponentRegister
internal static class ManagedComponentRegistry
{
private static readonly List<ManagedComponentInfo> s_registeredComponents = new();
private static readonly Dictionary<IntPtr, int> s_typeHandleToID = new();

View File

@@ -145,7 +145,7 @@ public readonly unsafe ref struct ChunkView
public readonly bool HasChanged<T>(int version)
where T : unmanaged, IComponent
{
var layout = GetLayout(ComponentTypeID<T>.value);
var layout = GetLayout(ComponentTypeID<T>.Value);
return version < _pVersion[layout.versionIndex];
}
@@ -180,7 +180,7 @@ public readonly unsafe ref struct ChunkView
public readonly int GetComponentVersion<T>()
where T : unmanaged, IComponent
{
return _pVersion[ComponentTypeID<T>.value];
return _pVersion[ComponentTypeID<T>.Value];
}
/// <summary>
@@ -204,7 +204,7 @@ public readonly unsafe ref struct ChunkView
public ReadOnlySpan<T> GetComponentData<T>()
where T : unmanaged, IComponent
{
var layout = GetLayout(ComponentTypeID<T>.value);
var layout = GetLayout(ComponentTypeID<T>.Value);
var pComponentData = _pChunkData + layout.offset;
return new ReadOnlySpan<T>(pComponentData, _entityCount);
}
@@ -219,7 +219,7 @@ public readonly unsafe ref struct ChunkView
public Span<T> GetComponentDataRW<T>()
where T : unmanaged, IComponent
{
var compId = ComponentTypeID<T>.value;
var compId = ComponentTypeID<T>.Value;
var layout = GetLayout(compId);
_pVersion[layout.versionIndex] = _currentVersion;
@@ -239,7 +239,7 @@ public readonly unsafe ref struct ChunkView
public SpanBitSet GetEnableBits<T>()
where T : unmanaged, IEnableableComponent
{
var layout = _layouts[ComponentTypeID<T>.value];
var layout = _layouts[ComponentTypeID<T>.Value];
var maskBase = _pChunkData + layout.enableBitsOffset;
return new SpanBitSet(new Span<uint>(maskBase, (_entityCount + 31) / 32));
}
@@ -255,7 +255,7 @@ public readonly unsafe ref struct ChunkView
public bool IsComponentEnabled<T>(int index)
where T : unmanaged, IEnableableComponent
{
var layout = GetLayout(ComponentTypeID<T>.value);
var layout = GetLayout(ComponentTypeID<T>.Value);
var pMask = _pChunkData + layout.enableBitsOffset;
return EntityQuery.CheckBit(pMask, index);
}
@@ -545,7 +545,7 @@ public ref partial struct QueryBuilder
foreach (var id in _none)
{
if (ComponentRegister.GetComponentInfo(id).isEnableable)
if (ComponentRegistry.GetComponentInfo(id).isEnableable)
{
mask.rejectIfEnabled.SetBit(id); // Filter: Must Not be Enabled (Can be Absent or Disabled)
}

View File

@@ -61,12 +61,12 @@ public abstract class SystemBase : ISystem
_requiredQueries.Add(queryID.value);
}
public void Initialize(ref readonly SystemAPI systemAPI)
void ISystem.Initialize(ref readonly SystemAPI systemAPI)
{
OnInitialize(in systemAPI);
}
public void Update(ref readonly SystemAPI systemAPI)
void ISystem.Update(ref readonly SystemAPI systemAPI)
{
if (ShouldUpdate())
{
@@ -87,7 +87,7 @@ public abstract class SystemBase : ISystem
}
}
public void Cleanup(ref readonly SystemAPI systemAPI)
void ISystem.Cleanup(ref readonly SystemAPI systemAPI)
{
OnCleanup(in systemAPI);
}
@@ -352,6 +352,8 @@ public class SystemManager
private readonly List<ISystem> _systems = [];
internal IReadOnlyList<ISystem> Systems => _systems;
internal SystemManager(World world)
{
_world = world;

View File

@@ -35,7 +35,7 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
@@ -224,11 +224,11 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
@@ -425,15 +425,15 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
@@ -636,19 +636,19 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
@@ -857,23 +857,23 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
_compTypeIDs[4] = ComponentTypeID<T4>.value;
_compTypeIDs[4] = ComponentTypeID<T4>.Value;
_offsets[4] = 0;
_compBasePtrs[4] = 0;
@@ -1088,27 +1088,27 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
_compTypeIDs[4] = ComponentTypeID<T4>.value;
_compTypeIDs[4] = ComponentTypeID<T4>.Value;
_offsets[4] = 0;
_compBasePtrs[4] = 0;
_compTypeIDs[5] = ComponentTypeID<T5>.value;
_compTypeIDs[5] = ComponentTypeID<T5>.Value;
_offsets[5] = 0;
_compBasePtrs[5] = 0;
@@ -1329,31 +1329,31 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
_compTypeIDs[4] = ComponentTypeID<T4>.value;
_compTypeIDs[4] = ComponentTypeID<T4>.Value;
_offsets[4] = 0;
_compBasePtrs[4] = 0;
_compTypeIDs[5] = ComponentTypeID<T5>.value;
_compTypeIDs[5] = ComponentTypeID<T5>.Value;
_offsets[5] = 0;
_compBasePtrs[5] = 0;
_compTypeIDs[6] = ComponentTypeID<T6>.value;
_compTypeIDs[6] = ComponentTypeID<T6>.Value;
_offsets[6] = 0;
_compBasePtrs[6] = 0;
@@ -1580,35 +1580,35 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
_compTypeIDs[4] = ComponentTypeID<T4>.value;
_compTypeIDs[4] = ComponentTypeID<T4>.Value;
_offsets[4] = 0;
_compBasePtrs[4] = 0;
_compTypeIDs[5] = ComponentTypeID<T5>.value;
_compTypeIDs[5] = ComponentTypeID<T5>.Value;
_offsets[5] = 0;
_compBasePtrs[5] = 0;
_compTypeIDs[6] = ComponentTypeID<T6>.value;
_compTypeIDs[6] = ComponentTypeID<T6>.Value;
_offsets[6] = 0;
_compBasePtrs[6] = 0;
_compTypeIDs[7] = ComponentTypeID<T7>.value;
_compTypeIDs[7] = ComponentTypeID<T7>.Value;
_offsets[7] = 0;
_compBasePtrs[7] = 0;

View File

@@ -71,7 +71,7 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
<# for (var j = 0; j < i; j++) { #>
_compTypeIDs[<#= j #>] = ComponentTypeID<T<#= j #>>.value;
_compTypeIDs[<#= j #>] = ComponentTypeID<T<#= j #>>.Value;
_offsets[<#= j #>] = 0;
_compBasePtrs[<#= j #>] = 0;

View File

@@ -55,7 +55,7 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
@@ -253,11 +253,11 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
@@ -461,15 +461,15 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
@@ -679,19 +679,19 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
@@ -907,23 +907,23 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
_compTypeIDs[4] = ComponentTypeID<T4>.value;
_compTypeIDs[4] = ComponentTypeID<T4>.Value;
_offsets[4] = 0;
_compBasePtrs[4] = 0;
@@ -1145,27 +1145,27 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
_compTypeIDs[4] = ComponentTypeID<T4>.value;
_compTypeIDs[4] = ComponentTypeID<T4>.Value;
_offsets[4] = 0;
_compBasePtrs[4] = 0;
_compTypeIDs[5] = ComponentTypeID<T5>.value;
_compTypeIDs[5] = ComponentTypeID<T5>.Value;
_offsets[5] = 0;
_compBasePtrs[5] = 0;
@@ -1393,31 +1393,31 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
_compTypeIDs[4] = ComponentTypeID<T4>.value;
_compTypeIDs[4] = ComponentTypeID<T4>.Value;
_offsets[4] = 0;
_compBasePtrs[4] = 0;
_compTypeIDs[5] = ComponentTypeID<T5>.value;
_compTypeIDs[5] = ComponentTypeID<T5>.Value;
_offsets[5] = 0;
_compBasePtrs[5] = 0;
_compTypeIDs[6] = ComponentTypeID<T6>.value;
_compTypeIDs[6] = ComponentTypeID<T6>.Value;
_offsets[6] = 0;
_compBasePtrs[6] = 0;
@@ -1651,35 +1651,35 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
_compTypeIDs[0] = ComponentTypeID<T0>.value;
_compTypeIDs[0] = ComponentTypeID<T0>.Value;
_offsets[0] = 0;
_compBasePtrs[0] = 0;
_compTypeIDs[1] = ComponentTypeID<T1>.value;
_compTypeIDs[1] = ComponentTypeID<T1>.Value;
_offsets[1] = 0;
_compBasePtrs[1] = 0;
_compTypeIDs[2] = ComponentTypeID<T2>.value;
_compTypeIDs[2] = ComponentTypeID<T2>.Value;
_offsets[2] = 0;
_compBasePtrs[2] = 0;
_compTypeIDs[3] = ComponentTypeID<T3>.value;
_compTypeIDs[3] = ComponentTypeID<T3>.Value;
_offsets[3] = 0;
_compBasePtrs[3] = 0;
_compTypeIDs[4] = ComponentTypeID<T4>.value;
_compTypeIDs[4] = ComponentTypeID<T4>.Value;
_offsets[4] = 0;
_compBasePtrs[4] = 0;
_compTypeIDs[5] = ComponentTypeID<T5>.value;
_compTypeIDs[5] = ComponentTypeID<T5>.Value;
_offsets[5] = 0;
_compBasePtrs[5] = 0;
_compTypeIDs[6] = ComponentTypeID<T6>.value;
_compTypeIDs[6] = ComponentTypeID<T6>.Value;
_offsets[6] = 0;
_compBasePtrs[6] = 0;
_compTypeIDs[7] = ComponentTypeID<T7>.value;
_compTypeIDs[7] = ComponentTypeID<T7>.Value;
_offsets[7] = 0;
_compBasePtrs[7] = 0;

View File

@@ -75,7 +75,7 @@ public unsafe partial struct EntityQuery
internal Enumerator(ReadOnlyUnsafeCollection<Identifier<Archetype>> matchingArchetypes, EntityQueryMask mask, World world)
{
<# for (var j = 0; j < i; j++) { #>
_compTypeIDs[<#= j #>] = ComponentTypeID<T<#= j #>>.value;
_compTypeIDs[<#= j #>] = ComponentTypeID<T<#= j #>>.Value;
_offsets[<#= j #>] = 0;
_compBasePtrs[<#= j #>] = 0;

View File

@@ -1,3 +1,4 @@
namespace Ghost.Entities;
public unsafe partial struct EntityQuery
@@ -8,7 +9,7 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -93,8 +94,8 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -182,9 +183,9 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -275,10 +276,10 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -372,11 +373,11 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp4TypeID = ComponentTypeID<T4>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var comp4TypeID = ComponentTypeID<T4>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -473,12 +474,12 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp4TypeID = ComponentTypeID<T4>.value;
var comp5TypeID = ComponentTypeID<T5>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var comp4TypeID = ComponentTypeID<T4>.Value;
var comp5TypeID = ComponentTypeID<T5>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -578,13 +579,13 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp4TypeID = ComponentTypeID<T4>.value;
var comp5TypeID = ComponentTypeID<T5>.value;
var comp6TypeID = ComponentTypeID<T6>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var comp4TypeID = ComponentTypeID<T4>.Value;
var comp5TypeID = ComponentTypeID<T5>.Value;
var comp6TypeID = ComponentTypeID<T6>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -687,14 +688,14 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp4TypeID = ComponentTypeID<T4>.value;
var comp5TypeID = ComponentTypeID<T5>.value;
var comp6TypeID = ComponentTypeID<T6>.value;
var comp7TypeID = ComponentTypeID<T7>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var comp4TypeID = ComponentTypeID<T4>.Value;
var comp5TypeID = ComponentTypeID<T5>.Value;
var comp6TypeID = ComponentTypeID<T6>.Value;
var comp7TypeID = ComponentTypeID<T7>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -792,7 +793,7 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -878,8 +879,8 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -968,9 +969,9 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -1062,10 +1063,10 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -1160,11 +1161,11 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp4TypeID = ComponentTypeID<T4>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var comp4TypeID = ComponentTypeID<T4>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -1262,12 +1263,12 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp4TypeID = ComponentTypeID<T4>.value;
var comp5TypeID = ComponentTypeID<T5>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var comp4TypeID = ComponentTypeID<T4>.Value;
var comp5TypeID = ComponentTypeID<T5>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -1368,13 +1369,13 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp4TypeID = ComponentTypeID<T4>.value;
var comp5TypeID = ComponentTypeID<T5>.value;
var comp6TypeID = ComponentTypeID<T6>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var comp4TypeID = ComponentTypeID<T4>.Value;
var comp5TypeID = ComponentTypeID<T5>.Value;
var comp6TypeID = ComponentTypeID<T6>.Value;
var compTypeIDs = stackalloc int[]
{
@@ -1478,14 +1479,14 @@ public unsafe partial struct EntityQuery
var world = World.GetWorldUncheck(_worldID);
var globalVersion = world.Version;
var comp0TypeID = ComponentTypeID<T0>.value;
var comp1TypeID = ComponentTypeID<T1>.value;
var comp2TypeID = ComponentTypeID<T2>.value;
var comp3TypeID = ComponentTypeID<T3>.value;
var comp4TypeID = ComponentTypeID<T4>.value;
var comp5TypeID = ComponentTypeID<T5>.value;
var comp6TypeID = ComponentTypeID<T6>.value;
var comp7TypeID = ComponentTypeID<T7>.value;
var comp0TypeID = ComponentTypeID<T0>.Value;
var comp1TypeID = ComponentTypeID<T1>.Value;
var comp2TypeID = ComponentTypeID<T2>.Value;
var comp3TypeID = ComponentTypeID<T3>.Value;
var comp4TypeID = ComponentTypeID<T4>.Value;
var comp5TypeID = ComponentTypeID<T5>.Value;
var comp6TypeID = ComponentTypeID<T6>.Value;
var comp7TypeID = ComponentTypeID<T7>.Value;
var compTypeIDs = stackalloc int[]
{

View File

@@ -26,7 +26,7 @@ public unsafe partial struct EntityQuery
var globalVersion = world.Version;
<# for (var localIndex = 0; localIndex < i; localIndex++) { #>
var comp<#= localIndex #>TypeID = ComponentTypeID<T<#= localIndex #>>.value;
var comp<#= localIndex #>TypeID = ComponentTypeID<T<#= localIndex #>>.Value;
<# } #>
var compTypeIDs = stackalloc int[]

View File

@@ -1118,7 +1118,7 @@ public unsafe partial struct EntityQuery
}
// Get offsets ONCE per archetype
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
var layout0 = arch.GetLayout(ComponentTypeID<T0>.Value)
.GetValueOrThrow();
// Add all chunks from this archetype
@@ -1154,7 +1154,7 @@ public unsafe partial struct EntityQuery
version = world.Version,
};
runner.componentIDs[0] = ComponentTypeID<T0>.value;
runner.componentIDs[0] = ComponentTypeID<T0>.Value;
var it = _mask.writeAccess.GetIterator();
while (it.Next(out var id))
@@ -1255,9 +1255,9 @@ public unsafe partial struct EntityQuery
}
// Get offsets ONCE per archetype
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
var layout0 = arch.GetLayout(ComponentTypeID<T0>.Value)
.GetValueOrThrow();
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
var layout1 = arch.GetLayout(ComponentTypeID<T1>.Value)
.GetValueOrThrow();
// Add all chunks from this archetype
@@ -1301,7 +1301,7 @@ public unsafe partial struct EntityQuery
version = world.Version,
};
runner.componentIDs[0] = ComponentTypeID<T0>.value;
runner.componentIDs[0] = ComponentTypeID<T0>.Value;
var it = _mask.writeAccess.GetIterator();
while (it.Next(out var id))
@@ -1419,11 +1419,11 @@ public unsafe partial struct EntityQuery
}
// Get offsets ONCE per archetype
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
var layout0 = arch.GetLayout(ComponentTypeID<T0>.Value)
.GetValueOrThrow();
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
var layout1 = arch.GetLayout(ComponentTypeID<T1>.Value)
.GetValueOrThrow();
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
var layout2 = arch.GetLayout(ComponentTypeID<T2>.Value)
.GetValueOrThrow();
// Add all chunks from this archetype
@@ -1475,7 +1475,7 @@ public unsafe partial struct EntityQuery
version = world.Version,
};
runner.componentIDs[0] = ComponentTypeID<T0>.value;
runner.componentIDs[0] = ComponentTypeID<T0>.Value;
var it = _mask.writeAccess.GetIterator();
while (it.Next(out var id))
@@ -1610,13 +1610,13 @@ public unsafe partial struct EntityQuery
}
// Get offsets ONCE per archetype
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
var layout0 = arch.GetLayout(ComponentTypeID<T0>.Value)
.GetValueOrThrow();
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
var layout1 = arch.GetLayout(ComponentTypeID<T1>.Value)
.GetValueOrThrow();
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
var layout2 = arch.GetLayout(ComponentTypeID<T2>.Value)
.GetValueOrThrow();
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
var layout3 = arch.GetLayout(ComponentTypeID<T3>.Value)
.GetValueOrThrow();
// Add all chunks from this archetype
@@ -1676,7 +1676,7 @@ public unsafe partial struct EntityQuery
version = world.Version,
};
runner.componentIDs[0] = ComponentTypeID<T0>.value;
runner.componentIDs[0] = ComponentTypeID<T0>.Value;
var it = _mask.writeAccess.GetIterator();
while (it.Next(out var id))
@@ -1828,15 +1828,15 @@ public unsafe partial struct EntityQuery
}
// Get offsets ONCE per archetype
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
var layout0 = arch.GetLayout(ComponentTypeID<T0>.Value)
.GetValueOrThrow();
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
var layout1 = arch.GetLayout(ComponentTypeID<T1>.Value)
.GetValueOrThrow();
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
var layout2 = arch.GetLayout(ComponentTypeID<T2>.Value)
.GetValueOrThrow();
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
var layout3 = arch.GetLayout(ComponentTypeID<T3>.Value)
.GetValueOrThrow();
var layout4 = arch.GetLayout(ComponentTypeID<T4>.value)
var layout4 = arch.GetLayout(ComponentTypeID<T4>.Value)
.GetValueOrThrow();
// Add all chunks from this archetype
@@ -1904,7 +1904,7 @@ public unsafe partial struct EntityQuery
version = world.Version,
};
runner.componentIDs[0] = ComponentTypeID<T0>.value;
runner.componentIDs[0] = ComponentTypeID<T0>.Value;
var it = _mask.writeAccess.GetIterator();
while (it.Next(out var id))
@@ -2073,17 +2073,17 @@ public unsafe partial struct EntityQuery
}
// Get offsets ONCE per archetype
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
var layout0 = arch.GetLayout(ComponentTypeID<T0>.Value)
.GetValueOrThrow();
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
var layout1 = arch.GetLayout(ComponentTypeID<T1>.Value)
.GetValueOrThrow();
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
var layout2 = arch.GetLayout(ComponentTypeID<T2>.Value)
.GetValueOrThrow();
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
var layout3 = arch.GetLayout(ComponentTypeID<T3>.Value)
.GetValueOrThrow();
var layout4 = arch.GetLayout(ComponentTypeID<T4>.value)
var layout4 = arch.GetLayout(ComponentTypeID<T4>.Value)
.GetValueOrThrow();
var layout5 = arch.GetLayout(ComponentTypeID<T5>.value)
var layout5 = arch.GetLayout(ComponentTypeID<T5>.Value)
.GetValueOrThrow();
// Add all chunks from this archetype
@@ -2159,7 +2159,7 @@ public unsafe partial struct EntityQuery
version = world.Version,
};
runner.componentIDs[0] = ComponentTypeID<T0>.value;
runner.componentIDs[0] = ComponentTypeID<T0>.Value;
var it = _mask.writeAccess.GetIterator();
while (it.Next(out var id))
@@ -2345,19 +2345,19 @@ public unsafe partial struct EntityQuery
}
// Get offsets ONCE per archetype
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
var layout0 = arch.GetLayout(ComponentTypeID<T0>.Value)
.GetValueOrThrow();
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
var layout1 = arch.GetLayout(ComponentTypeID<T1>.Value)
.GetValueOrThrow();
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
var layout2 = arch.GetLayout(ComponentTypeID<T2>.Value)
.GetValueOrThrow();
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
var layout3 = arch.GetLayout(ComponentTypeID<T3>.Value)
.GetValueOrThrow();
var layout4 = arch.GetLayout(ComponentTypeID<T4>.value)
var layout4 = arch.GetLayout(ComponentTypeID<T4>.Value)
.GetValueOrThrow();
var layout5 = arch.GetLayout(ComponentTypeID<T5>.value)
var layout5 = arch.GetLayout(ComponentTypeID<T5>.Value)
.GetValueOrThrow();
var layout6 = arch.GetLayout(ComponentTypeID<T6>.value)
var layout6 = arch.GetLayout(ComponentTypeID<T6>.Value)
.GetValueOrThrow();
// Add all chunks from this archetype
@@ -2441,7 +2441,7 @@ public unsafe partial struct EntityQuery
version = world.Version,
};
runner.componentIDs[0] = ComponentTypeID<T0>.value;
runner.componentIDs[0] = ComponentTypeID<T0>.Value;
var it = _mask.writeAccess.GetIterator();
while (it.Next(out var id))
@@ -2644,21 +2644,21 @@ public unsafe partial struct EntityQuery
}
// Get offsets ONCE per archetype
var layout0 = arch.GetLayout(ComponentTypeID<T0>.value)
var layout0 = arch.GetLayout(ComponentTypeID<T0>.Value)
.GetValueOrThrow();
var layout1 = arch.GetLayout(ComponentTypeID<T1>.value)
var layout1 = arch.GetLayout(ComponentTypeID<T1>.Value)
.GetValueOrThrow();
var layout2 = arch.GetLayout(ComponentTypeID<T2>.value)
var layout2 = arch.GetLayout(ComponentTypeID<T2>.Value)
.GetValueOrThrow();
var layout3 = arch.GetLayout(ComponentTypeID<T3>.value)
var layout3 = arch.GetLayout(ComponentTypeID<T3>.Value)
.GetValueOrThrow();
var layout4 = arch.GetLayout(ComponentTypeID<T4>.value)
var layout4 = arch.GetLayout(ComponentTypeID<T4>.Value)
.GetValueOrThrow();
var layout5 = arch.GetLayout(ComponentTypeID<T5>.value)
var layout5 = arch.GetLayout(ComponentTypeID<T5>.Value)
.GetValueOrThrow();
var layout6 = arch.GetLayout(ComponentTypeID<T6>.value)
var layout6 = arch.GetLayout(ComponentTypeID<T6>.Value)
.GetValueOrThrow();
var layout7 = arch.GetLayout(ComponentTypeID<T7>.value)
var layout7 = arch.GetLayout(ComponentTypeID<T7>.Value)
.GetValueOrThrow();
// Add all chunks from this archetype
@@ -2750,7 +2750,7 @@ public unsafe partial struct EntityQuery
version = world.Version,
};
runner.componentIDs[0] = ComponentTypeID<T0>.value;
runner.componentIDs[0] = ComponentTypeID<T0>.Value;
var it = _mask.writeAccess.GetIterator();
while (it.Next(out var id))

View File

@@ -151,7 +151,7 @@ public unsafe partial struct EntityQuery
// Get offsets ONCE per archetype
<# for (var j = 0; j < i; j++){ #>
var layout<#= j #> = arch.GetLayout(ComponentTypeID<T<#= j #>>.value)
var layout<#= j #> = arch.GetLayout(ComponentTypeID<T<#= j #>>.Value)
.GetValueOrThrow();
<# } #>
@@ -192,7 +192,7 @@ public unsafe partial struct EntityQuery
version = world.Version,
};
runner.componentIDs[0] = ComponentTypeID<T0>.value;
runner.componentIDs[0] = ComponentTypeID<T0>.Value;
var it = _mask.writeAccess.GetIterator();
while (it.Next(out var id))

View File

@@ -13,7 +13,7 @@ public ref partial struct QueryBuilder
public QueryBuilder WithAll<T0>()
where T0 : unmanaged, IComponent
{
_all.Add(ComponentTypeID<T0>.value);
_all.Add(ComponentTypeID<T0>.Value);
return this;
}
@@ -26,8 +26,8 @@ public ref partial struct QueryBuilder
public QueryBuilder WithAllRW<T0>()
where T0 : unmanaged, IComponent
{
_all.Add(ComponentTypeID<T0>.value);
_rw.Add(ComponentTypeID<T0>.value);
_all.Add(ComponentTypeID<T0>.Value);
_rw.Add(ComponentTypeID<T0>.Value);
return this;
}
@@ -40,7 +40,7 @@ public ref partial struct QueryBuilder
public QueryBuilder WithAny<T0>()
where T0 : unmanaged, IComponent
{
_any.Add(ComponentTypeID<T0>.value);
_any.Add(ComponentTypeID<T0>.Value);
return this;
}
@@ -53,7 +53,7 @@ public ref partial struct QueryBuilder
public QueryBuilder WithAbsent<T0>()
where T0 : unmanaged, IComponent
{
_absent.Add(ComponentTypeID<T0>.value);
_absent.Add(ComponentTypeID<T0>.Value);
return this;
}
@@ -66,7 +66,7 @@ public ref partial struct QueryBuilder
public QueryBuilder WithNone<T0>()
where T0 : unmanaged, IComponent
{
_none.Add(ComponentTypeID<T0>.value);
_none.Add(ComponentTypeID<T0>.Value);
return this;
}
@@ -79,7 +79,7 @@ public ref partial struct QueryBuilder
public QueryBuilder WithDisabled<T0>()
where T0 : unmanaged, IEnableableComponent
{
_disabled.Add(ComponentTypeID<T0>.value);
_disabled.Add(ComponentTypeID<T0>.Value);
return this;
}
@@ -92,7 +92,7 @@ public ref partial struct QueryBuilder
public QueryBuilder WithPresent<T0>()
where T0 : unmanaged, IComponent
{
_present.Add(ComponentTypeID<T0>.value);
_present.Add(ComponentTypeID<T0>.Value);
return this;
}
@@ -105,8 +105,8 @@ public ref partial struct QueryBuilder
public QueryBuilder WithPresentRW<T0>()
where T0 : unmanaged, IComponent
{
_present.Add(ComponentTypeID<T0>.value);
_rw.Add(ComponentTypeID<T0>.value);
_present.Add(ComponentTypeID<T0>.Value);
_rw.Add(ComponentTypeID<T0>.Value);
return this;
}
@@ -120,8 +120,8 @@ public ref partial struct QueryBuilder
where T0 : unmanaged, IComponent
where T1 : unmanaged, IComponent
{
_all.Add(ComponentTypeID<T0>.value);
_all.Add(ComponentTypeID<T1>.value);
_all.Add(ComponentTypeID<T0>.Value);
_all.Add(ComponentTypeID<T1>.Value);
return this;
}
@@ -135,10 +135,10 @@ public ref partial struct QueryBuilder
where T0 : unmanaged, IComponent
where T1 : unmanaged, IComponent
{
_all.Add(ComponentTypeID<T0>.value);
_rw.Add(ComponentTypeID<T0>.value);
_all.Add(ComponentTypeID<T1>.value);
_rw.Add(ComponentTypeID<T1>.value);
_all.Add(ComponentTypeID<T0>.Value);
_rw.Add(ComponentTypeID<T0>.Value);
_all.Add(ComponentTypeID<T1>.Value);
_rw.Add(ComponentTypeID<T1>.Value);
return this;
}
@@ -152,8 +152,8 @@ public ref partial struct QueryBuilder
where T0 : unmanaged, IComponent
where T1 : unmanaged, IComponent
{
_any.Add(ComponentTypeID<T0>.value);
_any.Add(ComponentTypeID<T1>.value);
_any.Add(ComponentTypeID<T0>.Value);
_any.Add(ComponentTypeID<T1>.Value);
return this;
}
@@ -167,8 +167,8 @@ public ref partial struct QueryBuilder
where T0 : unmanaged, IComponent
where T1 : unmanaged, IComponent
{
_absent.Add(ComponentTypeID<T0>.value);
_absent.Add(ComponentTypeID<T1>.value);
_absent.Add(ComponentTypeID<T0>.Value);
_absent.Add(ComponentTypeID<T1>.Value);
return this;
}
@@ -182,8 +182,8 @@ public ref partial struct QueryBuilder
where T0 : unmanaged, IComponent
where T1 : unmanaged, IComponent
{
_none.Add(ComponentTypeID<T0>.value);
_none.Add(ComponentTypeID<T1>.value);
_none.Add(ComponentTypeID<T0>.Value);
_none.Add(ComponentTypeID<T1>.Value);
return this;
}
@@ -197,8 +197,8 @@ public ref partial struct QueryBuilder
where T0 : unmanaged, IEnableableComponent
where T1 : unmanaged, IEnableableComponent
{
_disabled.Add(ComponentTypeID<T0>.value);
_disabled.Add(ComponentTypeID<T1>.value);
_disabled.Add(ComponentTypeID<T0>.Value);
_disabled.Add(ComponentTypeID<T1>.Value);
return this;
}
@@ -212,8 +212,8 @@ public ref partial struct QueryBuilder
where T0 : unmanaged, IComponent
where T1 : unmanaged, IComponent
{
_present.Add(ComponentTypeID<T0>.value);
_present.Add(ComponentTypeID<T1>.value);
_present.Add(ComponentTypeID<T0>.Value);
_present.Add(ComponentTypeID<T1>.Value);
return this;
}
@@ -227,10 +227,10 @@ public ref partial struct QueryBuilder
where T0 : unmanaged, IComponent
where T1 : unmanaged, IComponent
{
_present.Add(ComponentTypeID<T0>.value);
_rw.Add(ComponentTypeID<T0>.value);
_present.Add(ComponentTypeID<T1>.value);
_rw.Add(ComponentTypeID<T1>.value);
_present.Add(ComponentTypeID<T0>.Value);
_rw.Add(ComponentTypeID<T0>.Value);
_present.Add(ComponentTypeID<T1>.Value);
_rw.Add(ComponentTypeID<T1>.Value);
return this;
}
@@ -245,9 +245,9 @@ public ref partial struct QueryBuilder
where T1 : unmanaged, IComponent
where T2 : unmanaged, IComponent
{
_all.Add(ComponentTypeID<T0>.value);
_all.Add(ComponentTypeID<T1>.value);
_all.Add(ComponentTypeID<T2>.value);
_all.Add(ComponentTypeID<T0>.Value);
_all.Add(ComponentTypeID<T1>.Value);
_all.Add(ComponentTypeID<T2>.Value);
return this;
}
@@ -262,12 +262,12 @@ public ref partial struct QueryBuilder
where T1 : unmanaged, IComponent
where T2 : unmanaged, IComponent
{
_all.Add(ComponentTypeID<T0>.value);
_rw.Add(ComponentTypeID<T0>.value);
_all.Add(ComponentTypeID<T1>.value);
_rw.Add(ComponentTypeID<T1>.value);
_all.Add(ComponentTypeID<T2>.value);
_rw.Add(ComponentTypeID<T2>.value);
_all.Add(ComponentTypeID<T0>.Value);
_rw.Add(ComponentTypeID<T0>.Value);
_all.Add(ComponentTypeID<T1>.Value);
_rw.Add(ComponentTypeID<T1>.Value);
_all.Add(ComponentTypeID<T2>.Value);
_rw.Add(ComponentTypeID<T2>.Value);
return this;
}
@@ -282,9 +282,9 @@ public ref partial struct QueryBuilder
where T1 : unmanaged, IComponent
where T2 : unmanaged, IComponent
{
_any.Add(ComponentTypeID<T0>.value);
_any.Add(ComponentTypeID<T1>.value);
_any.Add(ComponentTypeID<T2>.value);
_any.Add(ComponentTypeID<T0>.Value);
_any.Add(ComponentTypeID<T1>.Value);
_any.Add(ComponentTypeID<T2>.Value);
return this;
}
@@ -299,9 +299,9 @@ public ref partial struct QueryBuilder
where T1 : unmanaged, IComponent
where T2 : unmanaged, IComponent
{
_absent.Add(ComponentTypeID<T0>.value);
_absent.Add(ComponentTypeID<T1>.value);
_absent.Add(ComponentTypeID<T2>.value);
_absent.Add(ComponentTypeID<T0>.Value);
_absent.Add(ComponentTypeID<T1>.Value);
_absent.Add(ComponentTypeID<T2>.Value);
return this;
}
@@ -316,9 +316,9 @@ public ref partial struct QueryBuilder
where T1 : unmanaged, IComponent
where T2 : unmanaged, IComponent
{
_none.Add(ComponentTypeID<T0>.value);
_none.Add(ComponentTypeID<T1>.value);
_none.Add(ComponentTypeID<T2>.value);
_none.Add(ComponentTypeID<T0>.Value);
_none.Add(ComponentTypeID<T1>.Value);
_none.Add(ComponentTypeID<T2>.Value);
return this;
}
@@ -333,9 +333,9 @@ public ref partial struct QueryBuilder
where T1 : unmanaged, IEnableableComponent
where T2 : unmanaged, IEnableableComponent
{
_disabled.Add(ComponentTypeID<T0>.value);
_disabled.Add(ComponentTypeID<T1>.value);
_disabled.Add(ComponentTypeID<T2>.value);
_disabled.Add(ComponentTypeID<T0>.Value);
_disabled.Add(ComponentTypeID<T1>.Value);
_disabled.Add(ComponentTypeID<T2>.Value);
return this;
}
@@ -350,9 +350,9 @@ public ref partial struct QueryBuilder
where T1 : unmanaged, IComponent
where T2 : unmanaged, IComponent
{
_present.Add(ComponentTypeID<T0>.value);
_present.Add(ComponentTypeID<T1>.value);
_present.Add(ComponentTypeID<T2>.value);
_present.Add(ComponentTypeID<T0>.Value);
_present.Add(ComponentTypeID<T1>.Value);
_present.Add(ComponentTypeID<T2>.Value);
return this;
}
@@ -367,12 +367,12 @@ public ref partial struct QueryBuilder
where T1 : unmanaged, IComponent
where T2 : unmanaged, IComponent
{
_present.Add(ComponentTypeID<T0>.value);
_rw.Add(ComponentTypeID<T0>.value);
_present.Add(ComponentTypeID<T1>.value);
_rw.Add(ComponentTypeID<T1>.value);
_present.Add(ComponentTypeID<T2>.value);
_rw.Add(ComponentTypeID<T2>.value);
_present.Add(ComponentTypeID<T0>.Value);
_rw.Add(ComponentTypeID<T0>.Value);
_present.Add(ComponentTypeID<T1>.Value);
_rw.Add(ComponentTypeID<T1>.Value);
_present.Add(ComponentTypeID<T2>.Value);
_rw.Add(ComponentTypeID<T2>.Value);
return this;
}

View File

@@ -25,7 +25,7 @@ public ref partial struct QueryBuilder
<#= restrictions #>
{
<# for (var j = 0; j < i; j++) { #>
_all.Add(ComponentTypeID<T<#= j #>>.value);
_all.Add(ComponentTypeID<T<#= j #>>.Value);
<# } #>
return this;
@@ -40,8 +40,8 @@ public ref partial struct QueryBuilder
<#= restrictions #>
{
<# for (var j = 0; j < i; j++) { #>
_all.Add(ComponentTypeID<T<#= j #>>.value);
_rw.Add(ComponentTypeID<T<#= j #>>.value);
_all.Add(ComponentTypeID<T<#= j #>>.Value);
_rw.Add(ComponentTypeID<T<#= j #>>.Value);
<# } #>
return this;
@@ -56,7 +56,7 @@ public ref partial struct QueryBuilder
<#= restrictions #>
{
<# for (var j = 0; j < i; j++) { #>
_any.Add(ComponentTypeID<T<#= j #>>.value);
_any.Add(ComponentTypeID<T<#= j #>>.Value);
<# } #>
return this;
@@ -71,7 +71,7 @@ public ref partial struct QueryBuilder
<#= restrictions #>
{
<# for (var j = 0; j < i; j++) { #>
_absent.Add(ComponentTypeID<T<#= j #>>.value);
_absent.Add(ComponentTypeID<T<#= j #>>.Value);
<# } #>
return this;
@@ -86,7 +86,7 @@ public ref partial struct QueryBuilder
<#= restrictions #>
{
<# for (var j = 0; j < i; j++) { #>
_none.Add(ComponentTypeID<T<#= j #>>.value);
_none.Add(ComponentTypeID<T<#= j #>>.Value);
<# } #>
return this;
@@ -101,7 +101,7 @@ public ref partial struct QueryBuilder
<#= enableRestrictions #>
{
<# for (var j = 0; j < i; j++) { #>
_disabled.Add(ComponentTypeID<T<#= j #>>.value);
_disabled.Add(ComponentTypeID<T<#= j #>>.Value);
<# } #>
return this;
@@ -116,7 +116,7 @@ public ref partial struct QueryBuilder
<#= restrictions #>
{
<# for (var j = 0; j < i; j++) { #>
_present.Add(ComponentTypeID<T<#= j #>>.value);
_present.Add(ComponentTypeID<T<#= j #>>.Value);
<# } #>
return this;
@@ -131,8 +131,8 @@ public ref partial struct QueryBuilder
<#= restrictions #>
{
<# for (var j = 0; j < i; j++) { #>
_present.Add(ComponentTypeID<T<#= j #>>.value);
_rw.Add(ComponentTypeID<T<#= j #>>.value);
_present.Add(ComponentTypeID<T<#= j #>>.Value);
_rw.Add(ComponentTypeID<T<#= j #>>.Value);
<# } #>
return this;