mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
add static pool.apply
This commit is contained in:
parent
26f141fca9
commit
760e3d7e0f
@ -370,6 +370,17 @@ namespace DCFApixels.DragonECS
|
||||
public static implicit operator EcsPool<T>(OptionalMarker a) { return a.GetInstance<EcsPool<T>>(); }
|
||||
public static implicit operator EcsPool<T>(EcsWorld.GetPoolInstanceMarker a) { return a.GetInstance<EcsPool<T>>(); }
|
||||
#endregion
|
||||
|
||||
#region Apply
|
||||
public static void Apply(ref T component, int entityID, short worldID)
|
||||
{
|
||||
EcsWorld.GetPoolInstance<EcsPool<T>>(worldID).TryAddOrGet(entityID) = component;
|
||||
}
|
||||
public static void Apply(ref T component, int entityID, EcsPool<T> pool)
|
||||
{
|
||||
pool.TryAddOrGet(entityID) = component;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class EcsPoolExtensions
|
||||
|
@ -317,6 +317,17 @@ namespace DCFApixels.DragonECS
|
||||
public static implicit operator EcsTagPool<T>(OptionalMarker a) { return a.GetInstance<EcsTagPool<T>>(); }
|
||||
public static implicit operator EcsTagPool<T>(EcsWorld.GetPoolInstanceMarker a) { return a.GetInstance<EcsTagPool<T>>(); }
|
||||
#endregion
|
||||
|
||||
#region Apply
|
||||
public static void Apply(ref T component, int entityID, short worldID)
|
||||
{
|
||||
EcsWorld.GetPoolInstance<EcsTagPool<T>>(worldID).TryAdd(entityID);
|
||||
}
|
||||
public static void Apply(ref T component, int entityID, EcsTagPool<T> pool)
|
||||
{
|
||||
pool.TryAdd(entityID);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class EcsTagPoolExtensions
|
||||
|
Loading…
Reference in New Issue
Block a user