mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +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);
|
||||
}
|
||||
|
||||
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
|
||||
public ReadOnlySpan<WorldComponentPoolAbstract> GetWorldComponents()
|
||||
{
|
||||
@ -251,11 +266,14 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region NullWorld
|
||||
private sealed class NullWorld : EcsWorld
|
||||
{
|
||||
internal NullWorld() : base(new EcsWorldConfig(4, 4, 4, 4, 4), null, 0) { }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DebuggerProxy
|
||||
protected partial class DebuggerProxy
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user