mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-19 02:24:37 +08:00
add EcsWorld.DestroyAndClearAllWorlds
This commit is contained in:
parent
af3f74bb55
commit
cb7e086dcd
@ -66,6 +66,21 @@ namespace DCFApixels.DragonECS
|
|||||||
return ref WorldComponentPool<T>.GetForWorldUnchecked(worldID);
|
return ref WorldComponentPool<T>.GetForWorldUnchecked(worldID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void DestroyAndClearAllWorlds()
|
||||||
|
{
|
||||||
|
for (int i = 1; i < _worlds.Length; i++)
|
||||||
|
{
|
||||||
|
var world = _worlds[i];
|
||||||
|
if (world == null) { continue; }
|
||||||
|
|
||||||
|
if(world.IsDestroyed == false)
|
||||||
|
{
|
||||||
|
world.Destroy();
|
||||||
|
}
|
||||||
|
world = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region WorldComponentPool
|
#region WorldComponentPool
|
||||||
public ReadOnlySpan<WorldComponentPoolAbstract> GetWorldComponents()
|
public ReadOnlySpan<WorldComponentPoolAbstract> GetWorldComponents()
|
||||||
{
|
{
|
||||||
@ -251,11 +266,14 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region NullWorld
|
||||||
private sealed class NullWorld : EcsWorld
|
private sealed class NullWorld : EcsWorld
|
||||||
{
|
{
|
||||||
internal NullWorld() : base(new EcsWorldConfig(4, 4, 4, 4, 4), null, 0) { }
|
internal NullWorld() : base(new EcsWorldConfig(4, 4, 4, 4, 4), null, 0) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region DebuggerProxy
|
#region DebuggerProxy
|
||||||
protected partial class DebuggerProxy
|
protected partial class DebuggerProxy
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user