mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 18:14:37 +08:00
add new getter methods to EcsWorld
This commit is contained in:
parent
143faf24e0
commit
a11c7de42c
@ -108,6 +108,17 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
return UncheckedGet<PoolCache<TPool>>().instance;
|
return UncheckedGet<PoolCache<TPool>>().instance;
|
||||||
}
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static TPool GetPool<TPool>(int worldID) where TPool : IEcsPoolImplementation, new()
|
||||||
|
{
|
||||||
|
return Get<PoolCache<TPool>>(worldID).instance;
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static TPool UncheckedGetPool<TPool>(int worldID) where TPool : IEcsPoolImplementation, new()
|
||||||
|
{
|
||||||
|
return UncheckedGet<PoolCache<TPool>>(worldID).instance;
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public TAspect GetAspect<TAspect>() where TAspect : EcsAspect
|
public TAspect GetAspect<TAspect>() where TAspect : EcsAspect
|
||||||
{
|
{
|
||||||
@ -123,6 +134,10 @@ namespace DCFApixels.DragonECS
|
|||||||
public ref T Get<T>() where T : struct => ref WorldComponentPool<T>.GetForWorld(id);
|
public ref T Get<T>() where T : struct => ref WorldComponentPool<T>.GetForWorld(id);
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public ref T UncheckedGet<T>() where T : struct => ref WorldComponentPool<T>.UncheckedGetForWorld(id);
|
public ref T UncheckedGet<T>() where T : struct => ref WorldComponentPool<T>.UncheckedGetForWorld(id);
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static ref T Get<T>(int worldID) where T : struct => ref WorldComponentPool<T>.GetForWorld(worldID);
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static ref T UncheckedGet<T>(int worldID) where T : struct => ref WorldComponentPool<T>.UncheckedGetForWorld(worldID);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Where Query
|
#region Where Query
|
||||||
|
@ -39,6 +39,8 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static ref T GetData<T>(int worldID) => ref WorldComponentPool<T>.GetForWorld(worldID);
|
public static ref T GetData<T>(int worldID) => ref WorldComponentPool<T>.GetForWorld(worldID);
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static ref T UncheckedGetData<T>(int worldID) => ref WorldComponentPool<T>.UncheckedGetForWorld(worldID);
|
||||||
|
|
||||||
private abstract class DataReleaser
|
private abstract class DataReleaser
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user