mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
add UncheckedGet for world component
This commit is contained in:
parent
b04756c03d
commit
aad94da19d
@ -116,6 +116,8 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ref T Get<T>() where T : struct => ref WorldComponentPool<T>.GetForWorld(id);
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ref T UncheckedGet<T>() where T : struct => ref WorldComponentPool<T>.UncheckedGetForWorld(id);
|
||||
#endregion
|
||||
|
||||
#region Where Query
|
||||
|
@ -57,6 +57,8 @@ namespace DCFApixels.DragonECS
|
||||
public static ref T Get(int itemIndex) => ref _items[itemIndex];
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref T GetForWorld(int worldID) => ref _items[GetItemIndex(worldID)];
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref T UncheckedGetForWorld(int worldID) => ref _items[_mapping[worldID]];
|
||||
public static int GetItemIndex(int worldID)
|
||||
{
|
||||
if (_mapping.Length < Worlds.Length)
|
||||
@ -79,7 +81,6 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
return itemIndex;
|
||||
}
|
||||
|
||||
private static void Release(int worldID)
|
||||
{
|
||||
ref short itemIndex = ref _mapping[worldID];
|
||||
|
Loading…
Reference in New Issue
Block a user