update Unpack

This commit is contained in:
Mikhail 2024-03-03 22:46:09 +08:00
parent 330261b971
commit 6f30b5de97
3 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,5 @@
using DCFApixels.DragonECS.Internal; using DCFApixels.DragonECS.Internal;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -671,7 +670,7 @@ namespace DCFApixels.DragonECS
if ((chunk & bit) != 0) if ((chunk & bit) != 0)
{ {
itemsCount--; itemsCount--;
if(count > componentIDs.Length) if (count > componentIDs.Length)
{ {
Array.Resize(ref componentIDs, count << 1); Array.Resize(ref componentIDs, count << 1);
} }

View File

@ -125,6 +125,12 @@ namespace DCFApixels.DragonECS
world = EcsWorld.GetWorld(this.world); world = EcsWorld.GetWorld(this.world);
id = this.id; id = this.id;
} }
public void Unpack(out int id, out short gen, out EcsWorld world)
{
world = EcsWorld.GetWorld(this.world);
gen = this.gen;
id = this.id;
}
public void Unpack(out int id, out int worldID) public void Unpack(out int id, out int worldID)
{ {
worldID = world; worldID = world;
@ -142,6 +148,13 @@ namespace DCFApixels.DragonECS
id = this.id; id = this.id;
return IsAlive; return IsAlive;
} }
public bool TryUnpack(out int id, out short gen, out EcsWorld world)
{
world = EcsWorld.GetWorld(this.world);
gen = this.gen;
id = this.id;
return IsAlive;
}
public bool TryUnpack(out int id, out int worldID) public bool TryUnpack(out int id, out int worldID)
{ {
worldID = world; worldID = world;