Update EntityManager and Archetype

This commit is contained in:
2025-12-04 15:03:01 +09:00
parent 948fae4401
commit 3bbf485fce
13 changed files with 397 additions and 131 deletions

View File

@@ -23,7 +23,7 @@ public unsafe class EntityCommandBuffer : IDisposable
}
private readonly EntityManager _entityManager;
private UnsafeList<Command> _commands;
private UnsafeList<Command> _commands; // TODO: Maybe use UnsafeArray<byte> directly?
public EntityCommandBuffer(EntityManager entityManager)
{
@@ -58,7 +58,7 @@ public unsafe class EntityCommandBuffer : IDisposable
}
public void AddComponent<T>(Entity entity, T component)
where T : unmanaged
where T : unmanaged, IComponent
{
var data = new UnsafeArray<byte>(sizeof(T), Misaki.HighPerformance.LowLevel.Buffer.Allocator.Persistent);
MemoryUtility.MemCpy(&component, data.GetUnsafePtr(), (nuint)sizeof(T));
@@ -75,7 +75,7 @@ public unsafe class EntityCommandBuffer : IDisposable
}
public void RemoveComponent<T>(Entity entity)
where T : unmanaged
where T : unmanaged, IComponent
{
var command = new Command
{