diff --git a/Svelto.ECS/AllowMultipleAttribute.cs b/Svelto.ECS/AllowMultipleAttribute.cs
deleted file mode 100644
index 37c26ec..0000000
--- a/Svelto.ECS/AllowMultipleAttribute.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;
-
-namespace Svelto.ECS
-{
- public class AllowMultipleAttribute : Attribute
- {
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/AllowMultipleAttribute.cs.meta b/Svelto.ECS/AllowMultipleAttribute.cs.meta
deleted file mode 100644
index a2d75c9..0000000
--- a/Svelto.ECS/AllowMultipleAttribute.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 29ca2992915771b4eb047f00a7a4b7a6
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/CheckEntityUtilities.cs b/Svelto.ECS/CheckEntityUtilities.cs
deleted file mode 100644
index 0b061f6..0000000
--- a/Svelto.ECS/CheckEntityUtilities.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-#if DEBUG && !PROFILER
-using System.Collections.Generic;
-using Svelto.DataStructures;
-#else
-using System.Diagnostics;
-#endif
-
-namespace Svelto.ECS
-{
- public partial class EnginesRoot
- {
-#if DEBUG && !PROFILER
- void CheckRemoveEntityID(EGID egid)
- {
- // Console.LogError("removed".FastConcat(egid.ToString()));
- if (_idCheckers.TryGetValue(egid.groupID, out var hash))
- {
- if (hash.Contains(egid.entityID) == false)
- throw new ECSException("Entity with not found ID is about to be removed: id: "
- .FastConcat(egid.entityID)
- .FastConcat(" groupid: ")
- .FastConcat(egid.groupID));
-
- hash.Remove(egid.entityID);
-
- if (hash.Count == 0)
- _idCheckers.Remove(egid.groupID);
- }
- else
- {
- throw new ECSException("Entity with not found ID is about to be removed: id: "
- .FastConcat(egid.entityID)
- .FastConcat(" groupid: ")
- .FastConcat(egid.groupID));
- }
- }
-
- void CheckAddEntityID(EGID egid)
- {
-// Console.LogError("added ".FastConcat(egid.ToString()));
-
- if (_idCheckers.TryGetValue(egid.groupID, out var hash) == false)
- hash = _idCheckers[egid.groupID] = new HashSet();
- else
- {
- if (hash.Contains(egid.entityID))
- throw new ECSException("Entity with used ID is about to be built: '"
- .FastConcat("' id: '")
- .FastConcat(egid.entityID)
- .FastConcat("' groupid: '")
- .FastConcat(egid.groupID)
- .FastConcat("'"));
- }
-
- hash.Add(egid.entityID);
- }
-
- void RemoveGroupID(ExclusiveGroup.ExclusiveGroupStruct groupID)
- {
- _idCheckers.Remove(groupID);
- }
-
- readonly FasterDictionary> _idCheckers = new FasterDictionary>();
-#else
- [Conditional("_CHECKS_DISABLED")]
- void CheckRemoveEntityID(EGID egid)
- {
- }
-
- [Conditional("_CHECKS_DISABLED")]
- void CheckAddEntityID(EGID egid)
- {
- }
-
- [Conditional("_CHECKS_DISABLED")]
- void RemoveGroupID(ExclusiveGroup.ExclusiveGroupStruct groupID)
- {
- }
-#endif
- }
-}
diff --git a/Svelto.ECS/CheckEntityUtilities.cs.meta b/Svelto.ECS/CheckEntityUtilities.cs.meta
deleted file mode 100644
index 279a311..0000000
--- a/Svelto.ECS/CheckEntityUtilities.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: cda6cb7ffa71b954dbe3711e152399c2
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/DBC.cs b/Svelto.ECS/DBC.cs
deleted file mode 100644
index 144c690..0000000
--- a/Svelto.ECS/DBC.cs
+++ /dev/null
@@ -1,446 +0,0 @@
-#if DISABLE_DBC || !DEBUG || PROFILER
-#define DISABLE_CHECKS
-using System.Diagnostics;
-#endif
-using System;
-
-namespace DBC.ECS
-{
- ///
- /// Design By Contract Checks.
- ///
- /// Each method generates an exception or
- /// a trace assertion statement if the contract is broken.
- ///
- ///
- /// This example shows how to call the Require method.
- /// Assume DBC_CHECK_PRECONDITION is defined.
- ///
- /// public void Test(int x)
- /// {
- /// try
- /// {
- /// Check.Require(x > 1, "x must be > 1");
- /// }
- /// catch (System.Exception ex)
- /// {
- /// Console.WriteLine(ex.ToString());
- /// }
- /// }
- ///
- /// If you wish to use trace assertion statements, intended for Debug scenarios,
- /// rather than exception handling then set
- ///
- /// Check.UseAssertions = true
- ///
- /// You can specify this in your application entry point and maybe make it
- /// dependent on conditional compilation flags or configuration file settings, e.g.,
- ///
- /// #if DBC_USE_ASSERTIONS
- /// Check.UseAssertions = true;
- /// #endif
- ///
- /// You can direct output to a Trace listener. For example, you could insert
- ///
- /// Trace.Listeners.Clear();
- /// Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
- ///
- ///
- /// or direct output to a file or the Event Log.
- ///
- /// (Note: For ASP.NET clients use the Listeners collection
- /// of the Debug, not the Trace, object and, for a Release build, only exception-handling
- /// is possible.)
- ///
- ///
- static class Check
- {
- #region Interface
-
- ///
- /// Precondition check.
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Require(bool assertion, string message)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new PreconditionException(message);
- }
- else
- {
- Trace.Assert(assertion, "Precondition: " + message);
- }
- }
-
- ///
- /// Precondition check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Require(bool assertion, string message, Exception inner)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new PreconditionException(message, inner);
- }
- else
- {
- Trace.Assert(assertion, "Precondition: " + message);
- }
- }
-
- ///
- /// Precondition check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Require(bool assertion)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new PreconditionException("Precondition failed.");
- }
- else
- {
- Trace.Assert(assertion, "Precondition failed.");
- }
- }
-
- ///
- /// Postcondition check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Ensure(bool assertion, string message)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new PostconditionException(message);
- }
- else
- {
- Trace.Assert(assertion, "Postcondition: " + message);
- }
- }
-
- ///
- /// Postcondition check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Ensure(bool assertion, string message, Exception inner)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new PostconditionException(message, inner);
- }
- else
- {
- Trace.Assert(assertion, "Postcondition: " + message);
- }
- }
-
- ///
- /// Postcondition check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Ensure(bool assertion)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new PostconditionException("Postcondition failed.");
- }
- else
- {
- Trace.Assert(assertion, "Postcondition failed.");
- }
- }
-
- ///
- /// Invariant check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Invariant(bool assertion, string message)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new InvariantException(message);
- }
- else
- {
- Trace.Assert(assertion, "Invariant: " + message);
- }
- }
-
- ///
- /// Invariant check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Invariant(bool assertion, string message, Exception inner)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new InvariantException(message, inner);
- }
- else
- {
- Trace.Assert(assertion, "Invariant: " + message);
- }
- }
-
- ///
- /// Invariant check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Invariant(bool assertion)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new InvariantException("Invariant failed.");
- }
- else
- {
- Trace.Assert(assertion, "Invariant failed.");
- }
- }
-
- ///
- /// Assertion check.
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Assert(bool assertion, string message)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new AssertionException(message);
- }
- else
- {
- Trace.Assert(assertion, "Assertion: " + message);
- }
- }
-
- ///
- /// Assertion check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Assert(bool assertion, string message, Exception inner)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new AssertionException(message, inner);
- }
- else
- {
- Trace.Assert(assertion, "Assertion: " + message);
- }
- }
-
- ///
- /// Assertion check.
- ///
- ///
-#if DISABLE_CHECKS
- [Conditional("__NEVER_DEFINED__")]
-#endif
- public static void Assert(bool assertion)
- {
- if (UseExceptions)
- {
- if (!assertion)
- throw new AssertionException("Assertion failed.");
- }
- else
- {
- Trace.Assert(assertion, "Assertion failed.");
- }
- }
-
- ///
- /// Set this if you wish to use Trace Assert statements
- /// instead of exception handling.
- /// (The Check class uses exception handling by default.)
- ///
- public static bool UseAssertions
- {
-
- get
- {
- return useAssertions;
- }
- set
- {
- useAssertions = value;
- }
- }
-
- #endregion // Interface
-
- #region Implementation
-
- // No creation
-
- ///
- /// Is exception handling being used?
- ///
- static bool UseExceptions
- {
- get
- {
- return !useAssertions;
- }
- }
-
- // Are trace assertion statements being used?
- // Default is to use exception handling.
- static bool useAssertions;
-
- #endregion // Implementation
-
- } // End Check
-
- internal class Trace
- {
- internal static void Assert(bool assertion, string v)
- {
-#if NETFX_CORE
- System.Diagnostics.Contracts.Contract.Assert(assertion, v);
-#else
- System.Diagnostics.Trace.Assert(assertion, v);
-#endif
- }
- }
-
- #region Exceptions
-
- ///
- /// Exception raised when a contract is broken.
- /// Catch this exception type if you wish to differentiate between
- /// any DesignByContract exception and other runtime exceptions.
- ///
- ///
- public class DesignByContractException : Exception
- {
- protected DesignByContractException() {}
- protected DesignByContractException(string message) : base(message) {}
- protected DesignByContractException(string message, Exception inner) : base(message, inner) {}
- }
-
- ///
- /// Exception raised when a precondition fails.
- ///
- public class PreconditionException : DesignByContractException
- {
- ///
- /// Precondition Exception.
- ///
- public PreconditionException() {}
- ///
- /// Precondition Exception.
- ///
- public PreconditionException(string message) : base(message) {}
- ///
- /// Precondition Exception.
- ///
- public PreconditionException(string message, Exception inner) : base(message, inner) {}
- }
-
- ///
- /// Exception raised when a postcondition fails.
- ///
- public class PostconditionException : DesignByContractException
- {
- ///
- /// Postcondition Exception.
- ///
- public PostconditionException() {}
- ///
- /// Postcondition Exception.
- ///
- public PostconditionException(string message) : base(message) {}
- ///
- /// Postcondition Exception.
- ///
- public PostconditionException(string message, Exception inner) : base(message, inner) {}
- }
-
- ///
- /// Exception raised when an invariant fails.
- ///
- public class InvariantException : DesignByContractException
- {
- ///
- /// Invariant Exception.
- ///
- public InvariantException() {}
- ///
- /// Invariant Exception.
- ///
- public InvariantException(string message) : base(message) {}
- ///
- /// Invariant Exception.
- ///
- public InvariantException(string message, Exception inner) : base(message, inner) {}
- }
-
- ///
- /// Exception raised when an assertion fails.
- ///
- public class AssertionException : DesignByContractException
- {
- ///
- /// Assertion Exception.
- ///
- public AssertionException() {}
- ///
- /// Assertion Exception.
- ///
- public AssertionException(string message) : base(message) {}
- ///
- /// Assertion Exception.
- ///
- public AssertionException(string message, Exception inner) : base(message, inner) {}
- }
-
- #endregion // Exception classes
-
-} // End Design By Contract
diff --git a/Svelto.ECS/DBC.cs.meta b/Svelto.ECS/DBC.cs.meta
deleted file mode 100644
index 9b8e7c7..0000000
--- a/Svelto.ECS/DBC.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f25d12935fd762e40841aa5c56e603e4
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/DataStructures.meta b/Svelto.ECS/DataStructures.meta
deleted file mode 100644
index 4f856f2..0000000
--- a/Svelto.ECS/DataStructures.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 9d98d8ed291a59c4890021f6391142ca
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/DataStructures/SetEGIDWithoutBoxing.cs b/Svelto.ECS/DataStructures/SetEGIDWithoutBoxing.cs
deleted file mode 100644
index 828e598..0000000
--- a/Svelto.ECS/DataStructures/SetEGIDWithoutBoxing.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace Svelto.ECS.Internal
-{
- static class SetEGIDWithoutBoxing where T : struct, IEntityStruct
- {
- internal delegate void ActionCast(ref T target, EGID egid);
-
- public static readonly ActionCast SetIDWithoutBoxing = MakeSetter();
-
- static ActionCast MakeSetter()
- {
- if (EntityBuilder.HAS_EGID)
- {
-#if !ENABLE_IL2CPP
- Type myTypeA = typeof(T);
- PropertyInfo myFieldInfo = myTypeA.GetProperty("ID");
-
- ParameterExpression targetExp = Expression.Parameter(typeof(T).MakeByRefType(), "target");
- ParameterExpression valueExp = Expression.Parameter(typeof(EGID), "value");
- MemberExpression fieldExp = Expression.Property(targetExp, myFieldInfo);
- BinaryExpression assignExp = Expression.Assign(fieldExp, valueExp);
-
- var setter = Expression.Lambda(assignExp, targetExp, valueExp).Compile();
-
- return setter;
-#else
- return (ref T target, EGID value) =>
- {
- var needEgid = (target as INeedEGID);
- needEgid.ID = value;
- target = (T) needEgid;
- };
-#endif
- }
-
- return null;
- }
-
- public static void Warmup()
- {
- }
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/DataStructures/SetEGIDWithoutBoxing.cs.meta b/Svelto.ECS/DataStructures/SetEGIDWithoutBoxing.cs.meta
deleted file mode 100644
index 37e4e56..0000000
--- a/Svelto.ECS/DataStructures/SetEGIDWithoutBoxing.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 1e8610cc771cdeb46a808788e49b21d1
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs b/Svelto.ECS/DataStructures/TypeSafeDictionary.cs
deleted file mode 100644
index d902d72..0000000
--- a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs
+++ /dev/null
@@ -1,222 +0,0 @@
-using System;
-using Svelto.Common;
-using Svelto.DataStructures;
-
-namespace Svelto.ECS.Internal
-{
- public interface ITypeSafeDictionary
- {
- int Count { get; }
- ITypeSafeDictionary Create();
-
- void AddEntitiesToEngines(
- FasterDictionary, FasterList> entityViewEnginesDb,
- ITypeSafeDictionary realDic, in PlatformProfiler profiler, ExclusiveGroup.ExclusiveGroupStruct @group);
-
- void RemoveEntitiesFromEngines(FasterDictionary, FasterList> entityViewEnginesDB,
- in PlatformProfiler profiler, ExclusiveGroup.ExclusiveGroupStruct @group);
-
- void AddEntitiesFromDictionary(ITypeSafeDictionary entitiesToSubmit, uint groupId);
-
- void MoveEntityFromEngines(EGID fromEntityGid, EGID? toEntityID, ITypeSafeDictionary toGroup,
- FasterDictionary, FasterList> engines, in PlatformProfiler profiler);
-
- void AddEntityToDictionary(EGID fromEntityGid, EGID toEntityID, ITypeSafeDictionary toGroup);
- void RemoveEntityFromDictionary(EGID fromEntityGid, in PlatformProfiler profiler);
-
- void SetCapacity(uint size);
- void Trim();
- void Clear();
- void FastClear();
- bool Has(uint entityIdEntityId);
- }
-
- class TypeSafeDictionary : FasterDictionary,
- ITypeSafeDictionary where TValue : struct, IEntityStruct
- {
- static readonly Type _type = typeof(TValue);
- static readonly string _typeName = _type.Name;
- static readonly bool _hasEgid = typeof(INeedEGID).IsAssignableFrom(_type);
-
- public TypeSafeDictionary(uint size) : base(size) {}
- public TypeSafeDictionary() {}
-
- public void AddEntitiesFromDictionary(ITypeSafeDictionary entitiesToSubmit, uint groupId)
- {
- var typeSafeDictionary = entitiesToSubmit as TypeSafeDictionary;
-
- foreach (var tuple in typeSafeDictionary)
- {
- try
- {
- if (_hasEgid) SetEGIDWithoutBoxing.SetIDWithoutBoxing(ref tuple.Value, new EGID(tuple.Key, groupId));
-
- Add(tuple.Key, tuple.Value);
- }
- catch (Exception e)
- {
- throw new TypeSafeDictionaryException(
- "trying to add an EntityView with the same ID more than once Entity: "
- .FastConcat(typeof(TValue).ToString()).FastConcat(", group ").FastConcat(groupId).FastConcat(", id ").FastConcat(tuple.Key), e);
- }
- }
- }
-
- public void AddEntitiesToEngines(
- FasterDictionary, FasterList> entityViewEnginesDB,
- ITypeSafeDictionary realDic, in PlatformProfiler profiler, ExclusiveGroup.ExclusiveGroupStruct @group)
- {
- var typeSafeDictionary = realDic as TypeSafeDictionary;
-
- //this can be optimized, should pass all the entities and not restart the process for each one
- foreach (var value in this)
- AddEntityViewToEngines(entityViewEnginesDB, ref typeSafeDictionary.GetValueByRef(value.Key), null,
- in profiler, new EGID(value.Key, group));
- }
-
- public void RemoveEntitiesFromEngines(
- FasterDictionary, FasterList> entityViewEnginesDB,
- in PlatformProfiler profiler, ExclusiveGroup.ExclusiveGroupStruct @group)
- {
- foreach (var value in this)
- RemoveEntityViewFromEngines(entityViewEnginesDB, ref GetValueByRef(value.Key), null, in profiler,
- new EGID(value.Key, group));
- }
-
- public bool Has(uint entityIdEntityId)
- {
- return ContainsKey(entityIdEntityId);
- }
-
- public void RemoveEntityFromDictionary(EGID fromEntityGid, in PlatformProfiler profiler)
- {
- Remove(fromEntityGid.entityID);
- }
-
- public void AddEntityToDictionary(EGID fromEntityGid, EGID toEntityID, ITypeSafeDictionary toGroup)
- {
- var valueIndex = GetIndex(fromEntityGid.entityID);
-
- if (toGroup != null)
- {
- var toGroupCasted = toGroup as TypeSafeDictionary;
- ref var entity = ref valuesArray[valueIndex];
-
- if (_hasEgid) SetEGIDWithoutBoxing.SetIDWithoutBoxing(ref entity, toEntityID);
-
- toGroupCasted.Add(fromEntityGid.entityID, entity);
- }
- }
-
- public void MoveEntityFromEngines(EGID fromEntityGid, EGID? toEntityID, ITypeSafeDictionary toGroup,
- FasterDictionary, FasterList> engines, in PlatformProfiler profiler)
- {
- var valueIndex = GetIndex(fromEntityGid.entityID);
-
- ref var entity = ref valuesArray[valueIndex];
-
- if (toGroup != null)
- {
- RemoveEntityViewFromEngines(engines, ref entity, fromEntityGid.groupID, in profiler,
- fromEntityGid);
-
- var toGroupCasted = toGroup as TypeSafeDictionary;
- var previousGroup = fromEntityGid.groupID;
-
- if (_hasEgid) SetEGIDWithoutBoxing.SetIDWithoutBoxing(ref entity, toEntityID.Value);
-
- var index = toGroupCasted.GetIndex(toEntityID.Value.entityID);
-
- AddEntityViewToEngines(engines, ref toGroupCasted.valuesArray[index], previousGroup,
- in profiler, toEntityID.Value);
- }
- else
- RemoveEntityViewFromEngines(engines, ref entity, null, in profiler, fromEntityGid);
- }
-
- public ITypeSafeDictionary Create()
- {
- return new TypeSafeDictionary();
- }
-
- void AddEntityViewToEngines(FasterDictionary, FasterList> entityViewEnginesDB,
- ref TValue entity, ExclusiveGroup.ExclusiveGroupStruct? previousGroup,
- in PlatformProfiler profiler, EGID egid)
- {
- //get all the engines linked to TValue
- if (!entityViewEnginesDB.TryGetValue(new RefWrapper(_type), out var entityViewsEngines)) return;
-
- if (previousGroup == null)
- {
- for (var i = 0; i < entityViewsEngines.Count; i++)
- try
- {
- using (profiler.Sample(entityViewsEngines[i], _typeName))
- {
- (entityViewsEngines[i] as IReactOnAddAndRemove).Add(ref entity, egid);
- }
- }
- catch (Exception e)
- {
- throw new ECSException(
- "Code crashed inside Add callback ".FastConcat(typeof(TValue).ToString()), e);
- }
- }
- else
- {
- for (var i = 0; i < entityViewsEngines.Count; i++)
- try
- {
- using (profiler.Sample(entityViewsEngines[i], _typeName))
- {
- (entityViewsEngines[i] as IReactOnSwap).MovedTo(ref entity, previousGroup.Value,
- egid);
- }
- }
- catch (Exception e)
- {
- throw new ECSException(
- "Code crashed inside MovedTo callback ".FastConcat(typeof(TValue).ToString()), e);
- }
- }
- }
-
- static void RemoveEntityViewFromEngines(
- FasterDictionary, FasterList> @group, ref TValue entity,
- ExclusiveGroup.ExclusiveGroupStruct? previousGroup, in PlatformProfiler profiler, EGID egid)
- {
- if (!@group.TryGetValue(new RefWrapper(_type), out var entityViewsEngines)) return;
-
- if (previousGroup == null)
- {
- for (var i = 0; i < entityViewsEngines.Count; i++)
- try
- {
- using (profiler.Sample(entityViewsEngines[i], _typeName))
- (entityViewsEngines[i] as IReactOnAddAndRemove).Remove(ref entity, egid);
- }
- catch (Exception e)
- {
- throw new ECSException(
- "Code crashed inside Remove callback ".FastConcat(typeof(TValue).ToString()), e);
- }
- }
-#if SEEMS_UNNECESSARY
- else
- {
- for (var i = 0; i < entityViewsEngines.Count; i++)
- try
- {
- using (profiler.Sample(entityViewsEngines[i], _typeName))
- (entityViewsEngines[i] as IReactOnSwap).MovedFrom(ref entity, egid);
- }
- catch (Exception e)
- {
- throw new ECSException(
- "Code crashed inside Remove callback ".FastConcat(typeof(TValue).ToString()), e);
- }
- }
-#endif
- }
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs.meta b/Svelto.ECS/DataStructures/TypeSafeDictionary.cs.meta
deleted file mode 100644
index 8af9662..0000000
--- a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 5e812f7d5c7a03d4faebd6bbc9a06a2a
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/DataStructures/TypeSafeDictionaryException.cs b/Svelto.ECS/DataStructures/TypeSafeDictionaryException.cs
deleted file mode 100644
index 6f0a2c9..0000000
--- a/Svelto.ECS/DataStructures/TypeSafeDictionaryException.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Svelto.ECS
-{
- public class TypeSafeDictionaryException : Exception
- {
- public TypeSafeDictionaryException(string message, Exception exception) :
- base(message, exception)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/DataStructures/TypeSafeDictionaryException.cs.meta b/Svelto.ECS/DataStructures/TypeSafeDictionaryException.cs.meta
deleted file mode 100644
index 2402112..0000000
--- a/Svelto.ECS/DataStructures/TypeSafeDictionaryException.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 8c21456b4b0c7c9409264d02670f7f4c
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/Dispatcher.meta b/Svelto.ECS/Dispatcher.meta
deleted file mode 100644
index 4c0bbe2..0000000
--- a/Svelto.ECS/Dispatcher.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 67be04a8cde247c4d93885b1ff03ddec
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/Dispatcher/DispatchOnChange.cs b/Svelto.ECS/Dispatcher/DispatchOnChange.cs
deleted file mode 100644
index d1ce756..0000000
--- a/Svelto.ECS/Dispatcher/DispatchOnChange.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-
-namespace Svelto.ECS
-{
- public class DispatchOnChange : DispatchOnSet where T:IEquatable
- {
- public DispatchOnChange(EGID senderID) : base(senderID)
- { }
-
- public new T value
- {
- set
- {
- if (value.Equals(_value) == false)
- base.value = value;
- }
-
- get => _value;
- }
- }
-}
diff --git a/Svelto.ECS/Dispatcher/DispatchOnChange.cs.meta b/Svelto.ECS/Dispatcher/DispatchOnChange.cs.meta
deleted file mode 100644
index 6d3f060..0000000
--- a/Svelto.ECS/Dispatcher/DispatchOnChange.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 8b6d96ff87b04c140ad95db4cb267540
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/Dispatcher/DispatchOnSet.cs b/Svelto.ECS/Dispatcher/DispatchOnSet.cs
deleted file mode 100644
index d407ae8..0000000
--- a/Svelto.ECS/Dispatcher/DispatchOnSet.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System;
-
-namespace Svelto.ECS
-{
- public class DispatchOnSet
- {
- public DispatchOnSet(EGID senderID)
- {
- _senderID = senderID;
- }
-
- public T value
- {
- set
- {
- _value = value;
-
- if (_paused == false)
- _subscribers(_senderID, value);
- }
- }
-
- public void NotifyOnValueSet(Action action)
- {
- _subscribers += action;
- }
-
- public void StopNotify(Action action)
- {
- _subscribers -= action;
- }
-
- public void PauseNotify() { _paused = true; }
- public void ResumeNotify() { _paused = false; }
-
- protected T _value;
- readonly EGID _senderID;
-
- Action _subscribers;
- bool _paused;
- }
-}
diff --git a/Svelto.ECS/Dispatcher/DispatchOnSet.cs.meta b/Svelto.ECS/Dispatcher/DispatchOnSet.cs.meta
deleted file mode 100644
index 5513460..0000000
--- a/Svelto.ECS/Dispatcher/DispatchOnSet.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f3455e49716d5f44c9ed8da0880dead2
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/DynamicEntityDescriptor.cs b/Svelto.ECS/DynamicEntityDescriptor.cs
deleted file mode 100644
index f40d3e7..0000000
--- a/Svelto.ECS/DynamicEntityDescriptor.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-using System;
-using Svelto.DataStructures;
-
-namespace Svelto.ECS
-{
- ///
- /// DynamicEntityDescriptor can be used to add entity views to an existing EntityDescriptor that act as flags,
- /// at building time.
- /// This method allocates, so it shouldn't be abused
- ///
- ///
- public struct DynamicEntityDescriptor : IEntityDescriptor where TType : IEntityDescriptor, new()
- {
- internal DynamicEntityDescriptor(bool isExtendible) : this()
- {
- var defaultEntities = EntityDescriptorTemplate.descriptor.entitiesToBuild;
- var length = defaultEntities.Length;
-
- _entitiesToBuild = new IEntityBuilder[length + 1];
-
- Array.Copy(defaultEntities, 0, _entitiesToBuild, 0, length);
-
- //assign it after otherwise the previous copy will overwrite the value in case the item
- //is already present
- _entitiesToBuild[length] = new EntityBuilder
- (
- new EntityStructInfoView
- {
- entitiesToBuild = _entitiesToBuild
- }
- );
- }
-
- public DynamicEntityDescriptor(IEntityBuilder[] extraEntityBuilders) : this()
- {
- var extraEntitiesLength = extraEntityBuilders.Length;
-
- _entitiesToBuild = Construct(extraEntitiesLength, extraEntityBuilders,
- EntityDescriptorTemplate.descriptor.entitiesToBuild);
- }
-
- public DynamicEntityDescriptor(FasterList extraEntityBuilders) : this()
- {
- var extraEntities = extraEntityBuilders.ToArrayFast();
- var extraEntitiesLength = extraEntityBuilders.Count;
-
- _entitiesToBuild = Construct(extraEntitiesLength, extraEntities,
- EntityDescriptorTemplate.descriptor.entitiesToBuild);
- }
-
- public void ExtendWith() where T : IEntityDescriptor, new()
- {
- var newEntitiesToBuild = EntityDescriptorTemplate.descriptor.entitiesToBuild;
-
- _entitiesToBuild = Construct(newEntitiesToBuild.Length, newEntitiesToBuild, _entitiesToBuild);
- }
-
- public void ExtendWith(IEntityBuilder[] extraEntities)
- {
- _entitiesToBuild = Construct(extraEntities.Length, extraEntities, _entitiesToBuild);
- }
-
- static IEntityBuilder[] Construct(int extraEntitiesLength, IEntityBuilder[] extraEntities,
- IEntityBuilder[] startingEntities)
- {
- IEntityBuilder[] localEntitiesToBuild;
-
- if (extraEntitiesLength == 0)
- {
- localEntitiesToBuild = startingEntities;
- return localEntitiesToBuild;
- }
-
- var defaultEntities = startingEntities;
- var length = defaultEntities.Length;
-
- var index = SetupSpecialEntityStruct(defaultEntities, out localEntitiesToBuild, extraEntitiesLength);
-
- Array.Copy(extraEntities, 0, localEntitiesToBuild, length, extraEntitiesLength);
-
- //assign it after otherwise the previous copy will overwrite the value in case the item
- //is already present
- localEntitiesToBuild[index] = new EntityBuilder
- (
- new EntityStructInfoView
- {
- entitiesToBuild = localEntitiesToBuild
- }
- );
-
- return localEntitiesToBuild;
- }
-
- static int SetupSpecialEntityStruct(IEntityBuilder[] defaultEntities, out IEntityBuilder[] entitiesToBuild,
- int extraLenght)
- {
- int length = defaultEntities.Length;
- int index = -1;
-
- for (var i = 0; i < length; i++)
- {
- //the special entity already exists
- if (defaultEntities[i].GetEntityType() == EntityBuilderUtilities.ENTITY_STRUCT_INFO_VIEW)
- {
- index = i;
- break;
- }
- }
-
- if (index == -1)
- {
- index = length + extraLenght;
- entitiesToBuild = new IEntityBuilder[index + 1];
- }
- else
- entitiesToBuild = new IEntityBuilder[length + extraLenght];
-
- Array.Copy(defaultEntities, 0, entitiesToBuild, 0, length);
-
- return index;
- }
-
-
- public IEntityBuilder[] entitiesToBuild => _entitiesToBuild;
-
- IEntityBuilder[] _entitiesToBuild;
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/DynamicEntityDescriptor.cs.meta b/Svelto.ECS/DynamicEntityDescriptor.cs.meta
deleted file mode 100644
index e75eb39..0000000
--- a/Svelto.ECS/DynamicEntityDescriptor.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f44f311aa89faee408fe3591032a1bb9
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/ECSException.cs b/Svelto.ECS/ECSException.cs
deleted file mode 100644
index b815f84..0000000
--- a/Svelto.ECS/ECSException.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-
-namespace Svelto.ECS
-{
- public class ECSException : Exception
- {
- public ECSException(string message):base("".FastConcat(message, ""))
- {}
-
- public ECSException(string message, Exception innerE):base("".FastConcat(message, ""), innerE)
- {}
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/ECSException.cs.meta b/Svelto.ECS/ECSException.cs.meta
deleted file mode 100644
index 3edd782..0000000
--- a/Svelto.ECS/ECSException.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: ffc933f6fa0c64f46aa6e501ccac1eca
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/ECSResources.meta b/Svelto.ECS/ECSResources.meta
deleted file mode 100644
index 5e21225..0000000
--- a/Svelto.ECS/ECSResources.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: ed2ee43790d8ab0408efcd5ee7b4e80f
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/ECSResources/ECSResources.cs b/Svelto.ECS/ECSResources/ECSResources.cs
deleted file mode 100644
index 70ba614..0000000
--- a/Svelto.ECS/ECSResources/ECSResources.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using Svelto.DataStructures;
-
-namespace Svelto.ECS.Experimental
-{
- public struct ECSResources
- {
- internal uint id;
-
- public static implicit operator T(ECSResources ecsString) { return ResourcesECSDB.FromECS(ecsString.id); }
- }
-
- static class ResourcesECSDB
- {
- static readonly FasterList _resources = new FasterList();
-
- internal static ref T resources(uint id)
- {
- return ref _resources[(int) id - 1];
- }
-
- internal static uint ToECS(T resource)
- {
- _resources.Add(resource);
-
- return (uint)_resources.Count;
- }
-
- public static T FromECS(uint id)
- {
- if (id - 1 < _resources.Count)
- return _resources[(int) id - 1];
-
- return default;
- }
- }
-
- public static class ResourceExtensions
- {
- public static void Set(ref this ECSResources resource, T newText)
- {
- if (resource.id != 0)
- ResourcesECSDB.resources(resource.id) = newText;
- else
- resource.id = ResourcesECSDB.ToECS(newText);
- }
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/ECSResources/ECSResources.cs.meta b/Svelto.ECS/ECSResources/ECSResources.cs.meta
deleted file mode 100644
index e3f61da..0000000
--- a/Svelto.ECS/ECSResources/ECSResources.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 5afcd85ad92ffb344b04a1aa675814bf
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/ECSResources/ECSString.cs b/Svelto.ECS/ECSResources/ECSString.cs
deleted file mode 100644
index 4eac06c..0000000
--- a/Svelto.ECS/ECSResources/ECSString.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-
-namespace Svelto.ECS.Experimental
-{
- [Serialization.DoNotSerialize]
- public struct ECSString:IEquatable
- {
- uint id;
-
- public ECSString(string newText)
- {
- id = ResourcesECSDB.ToECS(newText);
- }
-
- public static implicit operator string(ECSString ecsString)
- {
- return ResourcesECSDB.FromECS(ecsString.id);
- }
-
- public void Set(string newText)
- {
- if (id != 0)
- ResourcesECSDB.resources(id) = newText;
- else
- id = ResourcesECSDB.ToECS(newText);
- }
-
- public bool Equals(ECSString other)
- {
- return other.id == id;
- }
-
- public override string ToString()
- {
- return ResourcesECSDB.FromECS(id);
- }
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/ECSResources/ECSString.cs.meta b/Svelto.ECS/ECSResources/ECSString.cs.meta
deleted file mode 100644
index 64844e6..0000000
--- a/Svelto.ECS/ECSResources/ECSString.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: a851028d58ed0754fa529a196e952859
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/EGID.cs b/Svelto.ECS/EGID.cs
deleted file mode 100644
index 4e7d768..0000000
--- a/Svelto.ECS/EGID.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-#pragma warning disable 660,661
-
-namespace Svelto.ECS
-{
- //todo: add debug map
- [Serialization.DoNotSerialize]
- [Serializable]
- public struct EGID:IEquatable,IEqualityComparer,IComparable
- {
- public uint entityID => (uint) (_GID & 0xFFFFFFFF);
-
- public ExclusiveGroup.ExclusiveGroupStruct groupID => new ExclusiveGroup.ExclusiveGroupStruct((uint) (_GID >> 32));
-
- public static bool operator ==(EGID obj1, EGID obj2)
- {
- return obj1._GID == obj2._GID;
- }
-
- public static bool operator !=(EGID obj1, EGID obj2)
- {
- return obj1._GID != obj2._GID;
- }
-
- public EGID(uint entityID, ExclusiveGroup.ExclusiveGroupStruct groupID) : this()
- {
- _GID = MAKE_GLOBAL_ID(entityID, groupID);
- }
-
- static ulong MAKE_GLOBAL_ID(uint entityId, uint groupId)
- {
- return (ulong)groupId << 32 | ((ulong)entityId & 0xFFFFFFFF);
- }
-
- public static explicit operator uint(EGID id)
- {
- return id.entityID;
- }
-
- //in the way it's used, ulong must be always the same for each id/group
- public static explicit operator ulong(EGID id) { return id._GID; }
-
- public bool Equals(EGID other)
- {
- return _GID == other._GID;
- }
-
- public bool Equals(EGID x, EGID y)
- {
- return x == y;
- }
-
- public int GetHashCode(EGID obj)
- {
- return _GID.GetHashCode();
- }
-
- public int CompareTo(EGID other)
- {
- return _GID.CompareTo(other._GID);
- }
-
- internal EGID(uint entityID, uint groupID) : this()
- {
- _GID = MAKE_GLOBAL_ID(entityID, groupID);
- }
-
- public override string ToString()
- {
- return "id ".FastConcat(entityID).FastConcat(" group ").FastConcat(groupID);
- }
-
- readonly ulong _GID;
- }
-}
diff --git a/Svelto.ECS/EGID.cs.meta b/Svelto.ECS/EGID.cs.meta
deleted file mode 100644
index 794a3fb..0000000
--- a/Svelto.ECS/EGID.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 107bb03a12307bb4f961b85b782e22e1
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/EGIDMapper.cs b/Svelto.ECS/EGIDMapper.cs
deleted file mode 100644
index 939e20b..0000000
--- a/Svelto.ECS/EGIDMapper.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using Svelto.DataStructures;
-
-namespace Svelto.ECS
-{
- public struct EGIDMapper where T : struct, IEntityStruct
- {
- internal FasterDictionary map;
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public ref T Entity(uint entityID)
- {
-#if DEBUG && !PROFILER
- if (map.TryFindIndex(entityID, out var findIndex) == false)
- throw new Exception("Entity not found in this group ".FastConcat(typeof(T).ToString()));
-#else
- map.TryFindIndex(entityID, out var findIndex);
-#endif
- return ref map.valuesArray[findIndex];
- }
-
- public bool TryGetEntity(uint entityID, out T value)
- {
- if (map.TryFindIndex(entityID, out var index))
- {
- value = map.GetDirectValue(index);
- return true;
- }
-
- value = default;
- return false;
- }
- }
-}
-
diff --git a/Svelto.ECS/EGIDMapper.cs.meta b/Svelto.ECS/EGIDMapper.cs.meta
deleted file mode 100644
index e5db383..0000000
--- a/Svelto.ECS/EGIDMapper.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: c28b51f353894904c831577c2c725122
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs b/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs
deleted file mode 100644
index f6077f3..0000000
--- a/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using Svelto.DataStructures;
-using Svelto.ECS.Internal;
-
-namespace Svelto.ECS
-{
- public partial class EnginesRoot
- {
- internal class DoubleBufferedEntitiesToAdd
- {
- const int MaximumNumberOfItemsPerFrameBeforeToClear = 100;
-
- internal void Swap()
- {
- Swap(ref current, ref other);
- Swap(ref currentEntitiesCreatedPerGroup, ref otherEntitiesCreatedPerGroup);
- }
-
- void Swap(ref T item1, ref T item2)
- {
- var toSwap = item2;
- item2 = item1;
- item1 = toSwap;
- }
-
- public void ClearOther()
- {
- //do not clear the groups created so far, they will be reused, unless they are too many!
- var otherCount = other.Count;
- if (otherCount > MaximumNumberOfItemsPerFrameBeforeToClear)
- {
- otherEntitiesCreatedPerGroup.FastClear();
- other.FastClear();
- return;
- }
- var otherValuesArray = other.valuesArray;
- for (int i = 0; i < otherCount; ++i)
- {
- var safeDictionariesCount = otherValuesArray[i].Count;
- var safeDictionaries = otherValuesArray[i].valuesArray;
- //do not remove the dictionaries of entities per type created so far, they will be reused
- if (safeDictionariesCount <= MaximumNumberOfItemsPerFrameBeforeToClear)
- {
- for (int j = 0; j < safeDictionariesCount; ++j)
- {
- //clear the dictionary of entities create do far (it won't allocate though)
- safeDictionaries[j].FastClear();
- }
- }
- else
- {
- otherValuesArray[i].FastClear();
- }
- }
-
- otherEntitiesCreatedPerGroup.FastClear();
- }
-
- internal FasterDictionary currentEntitiesCreatedPerGroup;
- internal FasterDictionary otherEntitiesCreatedPerGroup;
-
- internal FasterDictionary, ITypeSafeDictionary>> current;
- internal FasterDictionary, ITypeSafeDictionary>> other;
-
- readonly FasterDictionary, ITypeSafeDictionary>>
- _entityViewsToAddBufferA =
- new FasterDictionary, ITypeSafeDictionary>>();
-
- readonly FasterDictionary, ITypeSafeDictionary>>
- _entityViewsToAddBufferB =
- new FasterDictionary, ITypeSafeDictionary>>();
-
- readonly FasterDictionary _entitiesCreatedPerGroupA = new FasterDictionary();
- readonly FasterDictionary _entitiesCreatedPerGroupB = new FasterDictionary();
-
- public DoubleBufferedEntitiesToAdd()
- {
- currentEntitiesCreatedPerGroup = _entitiesCreatedPerGroupA;
- otherEntitiesCreatedPerGroup = _entitiesCreatedPerGroupB;
-
- current = _entityViewsToAddBufferA;
- other = _entityViewsToAddBufferB;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs.meta b/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs.meta
deleted file mode 100644
index 47f493c..0000000
--- a/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 317edb22c6fdcb447a576d39d928aae7
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/EnginesRoot.Engines.cs b/Svelto.ECS/EnginesRoot.Engines.cs
deleted file mode 100644
index 8438e5b..0000000
--- a/Svelto.ECS/EnginesRoot.Engines.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Svelto.DataStructures;
-using Svelto.ECS.Internal;
-using Svelto.ECS.Schedulers;
-
-namespace Svelto.ECS
-{
- public partial class EnginesRoot
- {
- public struct EntitiesSubmitter
- {
- public EntitiesSubmitter(EnginesRoot enginesRoot)
- {
- _weakReference = new DataStructures.WeakReference(enginesRoot);
- }
-
- public void Invoke()
- {
- if (_weakReference.IsValid)
- _weakReference.Target.SubmitEntityViews();
- }
-
- readonly DataStructures.WeakReference _weakReference;
- }
- ///
- /// Engines root contextualize your engines and entities. You don't need to limit yourself to one EngineRoot
- /// as multiple engines root could promote separation of scopes. The EntitySubmissionScheduler checks
- /// periodically if new entity must be submitted to the database and the engines. It's an external
- /// dependencies to be independent by the running platform as the user can define it.
- /// The EntitySubmissionScheduler cannot hold an EnginesRoot reference, that's why
- /// it must receive a weak reference of the EnginesRoot callback.
- ///
- public EnginesRoot(IEntitySubmissionScheduler entityViewScheduler)
- {
- _entitiesOperations = new FasterDictionary();
- _reactiveEnginesAddRemove = new FasterDictionary, FasterList>();
- _reactiveEnginesSwap = new FasterDictionary, FasterList>();
- _enginesSet = new FasterList();
- _enginesTypeSet = new HashSet();
- _disposableEngines = new FasterList();
- _transientEntitiesOperations = new FasterList();
-
- _groupEntityViewsDB = new FasterDictionary, ITypeSafeDictionary>>();
- _groupsPerEntity = new FasterDictionary, FasterDictionary>();
- _groupedEntityToAdd = new DoubleBufferedEntitiesToAdd();
-
- _entitiesStream = new EntitiesStream();
- _entitiesDB = new EntitiesDB(_groupEntityViewsDB, _groupsPerEntity, _entitiesStream);
-
- _scheduler = entityViewScheduler;
- _scheduler.onTick = new EntitiesSubmitter(this);
- }
-
- public EnginesRoot(IEntitySubmissionScheduler entityViewScheduler, bool isDeserializationOnly):this(entityViewScheduler)
- {
- _isDeserializationOnly = isDeserializationOnly;
- }
-
- public void AddEngine(IEngine engine)
- {
- var type = engine.GetType();
- var refWrapper = new RefWrapper(type);
- DBC.ECS.Check.Require(
- _enginesTypeSet.Contains(refWrapper) == false ||
- type.ContainsCustomAttribute(typeof(AllowMultipleAttribute)) == true,
- "The same engine has been added more than once, if intentional, use [AllowMultiple] class attribute "
- .FastConcat(engine.ToString()));
- try
- {
- if (engine is IReactOnAddAndRemove viewEngine)
- CheckEntityViewsEngine(viewEngine, _reactiveEnginesAddRemove);
-
- if (engine is IReactOnSwap viewEngineSwap)
- CheckEntityViewsEngine(viewEngineSwap, _reactiveEnginesSwap);
-
- _enginesTypeSet.Add(refWrapper);
- _enginesSet.Add(engine);
-
- if (engine is IDisposable)
- _disposableEngines.Add(engine as IDisposable);
-
- if (engine is IQueryingEntitiesEngine queryableEntityViewEngine)
- {
- queryableEntityViewEngine.entitiesDB = _entitiesDB;
- queryableEntityViewEngine.Ready();
- }
- }
- catch (Exception e)
- {
- throw new ECSException("Code crashed while adding engine ".FastConcat(engine.GetType().ToString(), " "), e);
- }
- }
-
- void CheckEntityViewsEngine(T engine, FasterDictionary, FasterList> engines)
- where T : class, IEngine
- {
- var interfaces = engine.GetType().GetInterfaces();
-
- foreach (var interf in interfaces)
- {
- if (interf.IsGenericTypeEx() && typeof(T).IsAssignableFrom(interf))
- {
- var genericArguments = interf.GetGenericArgumentsEx();
-
- AddEngine(engine, genericArguments, engines);
- }
- }
- }
-
- static void AddEngine(T engine, Type[] entityViewTypes,
- FasterDictionary, FasterList> engines)
- where T : class, IEngine
- {
- for (var i = 0; i < entityViewTypes.Length; i++)
- {
- var type = entityViewTypes[i];
-
- AddEngine(engine, engines, type);
- }
- }
-
- static void AddEngine(T engine, FasterDictionary, FasterList> engines, Type type)
- where T : class, IEngine
- {
- if (engines.TryGetValue(new RefWrapper(type), out var list) == false)
- {
- list = new FasterList();
-
- engines.Add(new RefWrapper(type), list);
- }
-
- list.Add(engine);
- }
-
- readonly FasterDictionary, FasterList> _reactiveEnginesAddRemove;
- readonly FasterDictionary, FasterList> _reactiveEnginesSwap;
- readonly FasterList _disposableEngines;
-
- readonly FasterList _enginesSet;
- readonly HashSet _enginesTypeSet;
- }
-}
\ No newline at end of file
diff --git a/Svelto.ECS/EnginesRoot.Engines.cs.meta b/Svelto.ECS/EnginesRoot.Engines.cs.meta
deleted file mode 100644
index 1e1c3a4..0000000
--- a/Svelto.ECS/EnginesRoot.Engines.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 63f9381d3d2e91f4eb2f890bb36c605b
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Svelto.ECS/EnginesRoot.Entities.cs b/Svelto.ECS/EnginesRoot.Entities.cs
deleted file mode 100644
index 08e3ffc..0000000
--- a/Svelto.ECS/EnginesRoot.Entities.cs
+++ /dev/null
@@ -1,305 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using Svelto.Common;
-using Svelto.DataStructures;
-using Svelto.ECS.Internal;
-
-namespace Svelto.ECS
-{
- public partial class EnginesRoot : IDisposable
- {
- ///
- /// Dispose an EngineRoot once not used anymore, so that all the
- /// engines are notified with the entities removed.
- /// It's a clean up process.
- ///
- public void Dispose()
- {
- using (var profiler = new PlatformProfiler("Final Dispose"))
- {
- foreach (var groups in _groupEntityViewsDB)
- {
- foreach (var entityList in groups.Value)
- {
- entityList.Value.RemoveEntitiesFromEngines(_reactiveEnginesAddRemove,
- profiler, new ExclusiveGroup.ExclusiveGroupStruct(groups.Key));
- }
- }
-
- _groupEntityViewsDB.Clear();
- _groupsPerEntity.Clear();
-
- foreach (var engine in _disposableEngines)
- engine.Dispose();
-
- _disposableEngines.Clear();
- _enginesSet.Clear();
- _enginesTypeSet.Clear();
- _reactiveEnginesSwap.Clear();
- _reactiveEnginesAddRemove.Clear();
-
- _entitiesOperations.Clear();
- _transientEntitiesOperations.Clear();
- _scheduler.Dispose();
-#if DEBUG && !PROFILER
- _idCheckers.Clear();
-#endif
- _groupedEntityToAdd = null;
-
- _entitiesStream.Dispose();
- }
-
- GC.SuppressFinalize(this);
- }
-
- ~EnginesRoot()
- {
- Console.LogWarning("Engines Root has been garbage collected, don't forget to call Dispose()!");
-
- Dispose();
- }
-
- ///--------------------------------------------
- ///
- public IEntityStreamConsumerFactory GenerateConsumerFactory()
- {
- return new GenericEntityStreamConsumerFactory(this);
- }
-
- public IEntityFactory GenerateEntityFactory()
- {
- return new GenericEntityFactory(this);
- }
-
- public IEntityFunctions GenerateEntityFunctions()
- {
- return new GenericEntityFunctions(this);
- }
-
- ///--------------------------------------------
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- EntityStructInitializer BuildEntity(EGID entityID, IEntityBuilder[] entitiesToBuild,
- IEnumerable