mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
Merge branch 'dev'
This commit is contained in:
commit
cbfe7930b3
@ -731,6 +731,14 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class EcsWorldExtenssions
|
||||
{
|
||||
public static bool IsNullOrDetroyed(this EcsWorld self)
|
||||
{
|
||||
return self == null || self.IsDestroyed;
|
||||
}
|
||||
}
|
||||
|
||||
#region Callbacks Interface
|
||||
public interface IEcsWorldEventListener
|
||||
{
|
||||
|
@ -105,49 +105,72 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#region TryGetters
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryGetID(out int id)
|
||||
{
|
||||
id = this.id;
|
||||
return IsAlive;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryGetWorld(out EcsWorld world)
|
||||
{
|
||||
world = EcsWorld.GetWorld(this.world);
|
||||
return IsAlive;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryGetWorldID(out short worldID)
|
||||
{
|
||||
worldID = world;
|
||||
return IsAlive;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unpack(out int id, out EcsWorld world)
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||
#endif
|
||||
world = EcsWorld.GetWorld(this.world);
|
||||
id = this.id;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unpack(out int id, out short gen, out EcsWorld world)
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||
#endif
|
||||
world = EcsWorld.GetWorld(this.world);
|
||||
gen = this.gen;
|
||||
id = this.id;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unpack(out int id, out short worldID)
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||
#endif
|
||||
worldID = world;
|
||||
id = this.id;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unpack(out int id, out short gen, out short worldID)
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
|
||||
#endif
|
||||
worldID = world;
|
||||
gen = this.gen;
|
||||
id = this.id;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryUnpack(out int id, out EcsWorld world)
|
||||
{
|
||||
world = EcsWorld.GetWorld(this.world);
|
||||
id = this.id;
|
||||
return IsAlive;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryUnpack(out int id, out short gen, out EcsWorld world)
|
||||
{
|
||||
world = EcsWorld.GetWorld(this.world);
|
||||
@ -155,12 +178,14 @@ namespace DCFApixels.DragonECS
|
||||
id = this.id;
|
||||
return IsAlive;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryUnpack(out int id, out short worldID)
|
||||
{
|
||||
worldID = world;
|
||||
id = this.id;
|
||||
return IsAlive;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryUnpack(out int id, out short gen, out short worldID)
|
||||
{
|
||||
worldID = world;
|
||||
@ -168,6 +193,49 @@ namespace DCFApixels.DragonECS
|
||||
id = this.id;
|
||||
return IsAlive;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public int GetIDUnchecked()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public EcsWorld GetWorldUnchecked()
|
||||
{
|
||||
return EcsWorld.GetWorld(world);
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public short GetWorldIDUnchecked()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void UnpackUnchecked(out int id, out EcsWorld world)
|
||||
{
|
||||
world = EcsWorld.GetWorld(this.world);
|
||||
id = this.id;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void UnpackUnchecked(out int id, out short gen, out EcsWorld world)
|
||||
{
|
||||
world = EcsWorld.GetWorld(this.world);
|
||||
gen = this.gen;
|
||||
id = this.id;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void UnpackUnchecked(out int id, out short worldID)
|
||||
{
|
||||
worldID = world;
|
||||
id = this.id;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void UnpackUnchecked(out int id, out short gen, out short worldID)
|
||||
{
|
||||
worldID = world;
|
||||
gen = this.gen;
|
||||
id = this.id;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
@ -333,4 +401,4 @@ namespace DCFApixels.DragonECS
|
||||
public enum EntState { Null, Dead, Alive, }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user