mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
add IEcsStructPool<T>.NewEntity()
This commit is contained in:
parent
04a2d44596
commit
1cc630edba
@ -249,6 +249,18 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
return self == null || self == EcsNullPool.instance;
|
return self == null || self == EcsNullPool.instance;
|
||||||
}
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static ref T NewEntity<T>(this IEcsStructPool<T> self) where T : struct
|
||||||
|
{
|
||||||
|
var e = self.World.NewEntity();
|
||||||
|
return ref self.Add(e);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static ref T NewEntity<T>(this IEcsStructPool<T> self, out int entityID) where T : struct
|
||||||
|
{
|
||||||
|
entityID = self.World.NewEntity();
|
||||||
|
return ref self.Add(entityID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user