diff --git a/src/Builtin/Aspects.cs b/src/Builtin/Aspects.cs index 6d93f84..9f552c9 100644 --- a/src/Builtin/Aspects.cs +++ b/src/Builtin/Aspects.cs @@ -146,7 +146,7 @@ public static EcsSpan Where(this TCollection entities, out A0 a0, out A1 a1) where A0 : EcsAspect where A1 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().Where(out a0, out a1); } @@ -171,7 +171,7 @@ where A0 : EcsAspect where A1 : EcsAspect where A2 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().Where(out a0, out a1, out a2); } @@ -199,7 +199,7 @@ where A1 : EcsAspect where A2 : EcsAspect where A3 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().Where(out a0, out a1, out a2, out a3); } @@ -230,7 +230,7 @@ where A2 : EcsAspect where A3 : EcsAspect where A4 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().Where(out a0, out a1, out a2, out a3, out a4); } @@ -264,7 +264,7 @@ where A3 : EcsAspect where A4 : EcsAspect where A5 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().Where(out a0, out a1, out a2, out a3, out a4, out a5); } @@ -296,7 +296,7 @@ public static EcsReadonlyGroup WhereToGroup(this TCollection entities, out A0 a0, out A1 a1) where A0 : EcsAspect where A1 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().WhereToGroup(out a0, out a1); } @@ -321,7 +321,7 @@ where A0 : EcsAspect where A1 : EcsAspect where A2 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().WhereToGroup(out a0, out a1, out a2); } @@ -349,7 +349,7 @@ where A1 : EcsAspect where A2 : EcsAspect where A3 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().WhereToGroup(out a0, out a1, out a2, out a3); } @@ -380,7 +380,7 @@ where A2 : EcsAspect where A3 : EcsAspect where A4 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().WhereToGroup(out a0, out a1, out a2, out a3, out a4); } @@ -414,7 +414,7 @@ where A3 : EcsAspect where A4 : EcsAspect where A5 : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().WhereToGroup(out a0, out a1, out a2, out a3, out a4, out a5); } diff --git a/src/Builtin/Worlds.cs b/src/Builtin/Worlds.cs index d98a1db..9e7fbc0 100644 --- a/src/Builtin/Worlds.cs +++ b/src/Builtin/Worlds.cs @@ -1,11 +1,11 @@ namespace DCFApixels.DragonECS { - public sealed class EcsDefaultWorld : EcsWorld + public sealed class EcsDefaultWorld : EcsWorld, IEntityStorage { public EcsDefaultWorld() : base(null) { } public EcsDefaultWorld(IEcsWorldConfig config) : base(config) { } } - public sealed class EcsEventWorld : EcsWorld + public sealed class EcsEventWorld : EcsWorld, IEntityStorage { public EcsEventWorld() : base(null) { } public EcsEventWorld(IEcsWorldConfig config) : base(config) { } diff --git a/src/Collections/EcsGroup.cs b/src/Collections/EcsGroup.cs index 2d2a281..f2a3603 100644 --- a/src/Collections/EcsGroup.cs +++ b/src/Collections/EcsGroup.cs @@ -144,7 +144,7 @@ namespace DCFApixels.DragonECS } [DebuggerTypeProxy(typeof(DebuggerProxy))] - public unsafe class EcsGroup : IDisposable, IEnumerable, IEntitiesCollection + public unsafe class EcsGroup : IDisposable, IEnumerable, IEntityStorage { private EcsWorld _source; private int[] _dense; diff --git a/src/EcsWorld.cs b/src/EcsWorld.cs index 2c485a7..c4e725a 100644 --- a/src/EcsWorld.cs +++ b/src/EcsWorld.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS { - public abstract partial class EcsWorld: IEntitiesCollection + public abstract partial class EcsWorld: IEntityStorage { public readonly short id; private IEcsWorldConfig _config; @@ -26,6 +26,8 @@ namespace DCFApixels.DragonECS private int _freeSpace; private bool _isEnableAutoReleaseDelEntBuffer = true; + private long _version = 0; + private List> _groups = new List>(); private Stack _groupsPool = new Stack(64); diff --git a/src/Executors/Queries.cs b/src/Executors/Queries.cs index 692f860..ba3062c 100644 --- a/src/Executors/Queries.cs +++ b/src/Executors/Queries.cs @@ -1,6 +1,6 @@ namespace DCFApixels.DragonECS { - public interface IEntitiesCollection + public interface IEntityStorage { EcsSpan ToSpan(); } @@ -9,7 +9,7 @@ #region Where public static EcsSpan Where(this TCollection entities, out TAspect aspect) where TAspect : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().Where(out aspect); } @@ -58,7 +58,7 @@ #region WhereToGroup public static EcsReadonlyGroup WhereToGroup(this TCollection entities, out TAspect aspect) where TAspect : EcsAspect - where TCollection : IEntitiesCollection + where TCollection : IEntityStorage { return entities.ToSpan().WhereToGroup(out aspect); }