mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
update entlong.TryUnpack
This commit is contained in:
parent
8b92b7136e
commit
5031853e91
@ -141,6 +141,11 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
{
|
{
|
||||||
throw new ArgumentException("The groups belong to different worlds.");
|
throw new ArgumentException("The groups belong to different worlds.");
|
||||||
}
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
|
internal static void ArgumentDifferentWorldsException()
|
||||||
|
{
|
||||||
|
throw new ArgumentException("The groups belong to different worlds.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
|
132
src/entlong.cs
132
src/entlong.cs
@ -136,7 +136,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Unpacking
|
#region Unpacking Try
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool TryGetID(out int id)
|
public bool TryGetID(out int id)
|
||||||
{
|
{
|
||||||
@ -156,6 +156,90 @@ namespace DCFApixels.DragonECS
|
|||||||
return IsAlive;
|
return IsAlive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(out int id)
|
||||||
|
{
|
||||||
|
id = _id;
|
||||||
|
return IsAlive;
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(out int id, out EcsWorld world)
|
||||||
|
{
|
||||||
|
world = GetWorld_Internal();
|
||||||
|
id = _id;
|
||||||
|
return IsAlive;
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(out int id, out short gen, out EcsWorld world)
|
||||||
|
{
|
||||||
|
world = GetWorld_Internal();
|
||||||
|
gen = _gen;
|
||||||
|
id = _id;
|
||||||
|
return IsAlive;
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(out int id, out short worldID)
|
||||||
|
{
|
||||||
|
worldID = _world;
|
||||||
|
id = _id;
|
||||||
|
return IsAlive;
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(out int id, out short gen, out short worldID)
|
||||||
|
{
|
||||||
|
worldID = _world;
|
||||||
|
gen = _gen;
|
||||||
|
id = _id;
|
||||||
|
return IsAlive;
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(EcsWorld world, out int id)
|
||||||
|
{
|
||||||
|
if (world.ID != _world) { Throw.ArgumentDifferentWorldsException(); }
|
||||||
|
id = _id;
|
||||||
|
return world.IsAlive(_id, _gen);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(EcsWorld world, out int id, out short gen)
|
||||||
|
{
|
||||||
|
if (world.ID != _world) { Throw.ArgumentDifferentWorldsException(); }
|
||||||
|
gen = _gen;
|
||||||
|
id = _id;
|
||||||
|
return world.IsAlive(_id, _gen);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(EcsMask mask, out int id)
|
||||||
|
{
|
||||||
|
if (mask.WorldID != _world) { Throw.ArgumentDifferentWorldsException(); }
|
||||||
|
id = _id;
|
||||||
|
return mask.World.IsAlive(_id, _gen);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(EcsMask mask, out int id, out short gen)
|
||||||
|
{
|
||||||
|
if (mask.WorldID != _world) { Throw.ArgumentDifferentWorldsException(); }
|
||||||
|
gen = _gen;
|
||||||
|
id = _id;
|
||||||
|
return mask.World.IsAlive(_id, _gen);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(EcsAspect aspect, out int id)
|
||||||
|
{
|
||||||
|
if (aspect.World.ID != _world) { Throw.ArgumentDifferentWorldsException(); }
|
||||||
|
id = _id;
|
||||||
|
return aspect.World.IsAlive(_id, _gen);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool TryUnpack(EcsAspect aspect, out int id, out short gen)
|
||||||
|
{
|
||||||
|
if (aspect.World.ID != _world) { Throw.ArgumentDifferentWorldsException(); }
|
||||||
|
gen = _gen;
|
||||||
|
id = _id;
|
||||||
|
return aspect.World.IsAlive(_id, _gen);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Unpacking/Deconstruct
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Unpack(out int id)
|
public void Unpack(out int id)
|
||||||
{
|
{
|
||||||
@ -238,46 +322,13 @@ namespace DCFApixels.DragonECS
|
|||||||
gen = _gen;
|
gen = _gen;
|
||||||
id = _id;
|
id = _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool TryUnpack(out int id)
|
public void Deconstruct(out int id, out short gen, out short worldID) { Unpack(out id, out gen, out worldID); }
|
||||||
{
|
|
||||||
id = _id;
|
|
||||||
return IsAlive;
|
|
||||||
}
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool TryUnpack(out int id, out EcsWorld world)
|
public void Deconstruct(out int id, out EcsWorld world) { Unpack(out id, out world); }
|
||||||
{
|
|
||||||
world = GetWorld_Internal();
|
|
||||||
id = _id;
|
|
||||||
return IsAlive;
|
|
||||||
}
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public bool TryUnpack(out int id, out short gen, out EcsWorld world)
|
|
||||||
{
|
|
||||||
world = GetWorld_Internal();
|
|
||||||
gen = _gen;
|
|
||||||
id = _id;
|
|
||||||
return IsAlive;
|
|
||||||
}
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public bool TryUnpack(out int id, out short worldID)
|
|
||||||
{
|
|
||||||
worldID = _world;
|
|
||||||
id = _id;
|
|
||||||
return IsAlive;
|
|
||||||
}
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public bool TryUnpack(out int id, out short gen, out short worldID)
|
|
||||||
{
|
|
||||||
worldID = _world;
|
|
||||||
gen = _gen;
|
|
||||||
id = _id;
|
|
||||||
return IsAlive;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Unpacking
|
#region Unpacking Unchecked
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public int GetIDUnchecked()
|
public int GetIDUnchecked()
|
||||||
{
|
{
|
||||||
@ -352,13 +403,6 @@ namespace DCFApixels.DragonECS
|
|||||||
public static explicit operator int(entlong a) { return a.ID; }
|
public static explicit operator int(entlong a) { return a.ID; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Deconstruct
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public void Deconstruct(out int id, out short gen, out short worldID) { Unpack(out id, out gen, out worldID); }
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public void Deconstruct(out int id, out EcsWorld world) { Unpack(out id, out world); }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Other
|
#region Other
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private EcsWorld GetWorld_Internal()
|
private EcsWorld GetWorld_Internal()
|
||||||
|
Loading…
Reference in New Issue
Block a user