diff --git a/Svelto.Common b/Svelto.Common index 4f7d4d9..70c3fa3 160000 --- a/Svelto.Common +++ b/Svelto.Common @@ -1 +1 @@ -Subproject commit 4f7d4d96407f3ce390a23b930ba235a2447729ec +Subproject commit 70c3fa30662f89cd1b023802f114dd917e156d2e diff --git a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs b/Svelto.ECS/DataStructures/TypeSafeDictionary.cs index 5266477..9d33194 100644 --- a/Svelto.ECS/DataStructures/TypeSafeDictionary.cs +++ b/Svelto.ECS/DataStructures/TypeSafeDictionary.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Svelto.DataStructures; using Svelto.DataStructures.Experimental; @@ -32,6 +32,7 @@ namespace Svelto.ECS.Internal bool Remove(int idGid); int Count { get; } + void Trim(); } class TypeSafeDictionary : FasterDictionary, ITypeSafeDictionary where TValue : IEntityStruct diff --git a/Svelto.ECS/Dispatcher/DispatchOnChange.cs b/Svelto.ECS/Dispatcher/DispatchOnChange.cs index b6ddb5f..68a4ad1 100644 --- a/Svelto.ECS/Dispatcher/DispatchOnChange.cs +++ b/Svelto.ECS/Dispatcher/DispatchOnChange.cs @@ -7,9 +7,6 @@ namespace Svelto.ECS public DispatchOnChange(int senderID) : base(senderID) { } - public DispatchOnChange(EGID senderID) : base(senderID) - { } - public DispatchOnChange() {} public new T value diff --git a/Svelto.ECS/Dispatcher/DispatchOnSet.cs b/Svelto.ECS/Dispatcher/DispatchOnSet.cs index fddaba8..bd38c07 100644 --- a/Svelto.ECS/Dispatcher/DispatchOnSet.cs +++ b/Svelto.ECS/Dispatcher/DispatchOnSet.cs @@ -4,22 +4,17 @@ namespace Svelto.ECS { public class DispatchOnSet where T:struct { - public DispatchOnSet(int senderID):this() + public DispatchOnSet(int senderID) { - _senderID = new EGID(senderID, ExclusiveGroup.StandardEntitiesGroup); + _senderID = senderID; + _subscribers = new WeakEvent(); } - - public DispatchOnSet(EGID senderID):this() - { - _senderID = senderID; - } - + public DispatchOnSet() - { - _senderID = new EGID(); - _subscribers = new WeakEvent(); + { + _subscribers = new WeakEvent(); } - + public T value { set @@ -35,19 +30,19 @@ namespace Svelto.ECS } } - public void NotifyOnValueSet(System.Action action) + public void NotifyOnValueSet(System.Action action) { _subscribers += action; } - public void StopNotify(System.Action action) + public void StopNotify(System.Action action) { _subscribers -= action; } protected T _value; - readonly EGID _senderID; + readonly int _senderID; - WeakEvent _subscribers; + WeakEvent _subscribers; } } diff --git a/Svelto.ECS/EGID.cs b/Svelto.ECS/EGID.cs index 7e21114..e4e5612 100644 --- a/Svelto.ECS/EGID.cs +++ b/Svelto.ECS/EGID.cs @@ -1,5 +1,3 @@ -using Svelto.ECS.Internal; - namespace Svelto.ECS { public struct EGID diff --git a/Svelto.ECS/EnginesRoot.Entities.cs b/Svelto.ECS/EnginesRoot.Entities.cs index a079afc..8ed5a3b 100644 --- a/Svelto.ECS/EnginesRoot.Entities.cs +++ b/Svelto.ECS/EnginesRoot.Entities.cs @@ -150,7 +150,9 @@ namespace Svelto.ECS { _groupedGroups[entityType].Remove(toGroupID); - fromGroup.Remove(entityType); + //it's probably better to not remove this, but the dictionary should be trimmed? + //fromGroup.Remove(entityType); + fromTypeSafeDictionary.Trim(); } //it doesn't eliminate the fromGroup itself on purpose diff --git a/Svelto.ECS/EnginesRoot.Submission.cs b/Svelto.ECS/EnginesRoot.Submission.cs index 94d8b43..c9f94bc 100644 --- a/Svelto.ECS/EnginesRoot.Submission.cs +++ b/Svelto.ECS/EnginesRoot.Submission.cs @@ -90,7 +90,7 @@ namespace Svelto.ECS //one datastructure rule them all: //split by group //split by type per group. It's possible to get all the entities of a give type T per group thanks - //to the FasterDictionary capabilitiies OR it's possible to get a specific entityView indexed by + //to the FasterDictionary capabilities OR it's possible to get a specific entityView indexed by //ID. This ID doesn't need to be the EGID, it can be just the entityID readonly Dictionary> _groupEntityDB;