diff --git a/Svelto.ECS/Dispatcher/DispatchOnSet.cs b/Svelto.ECS/Dispatcher/DispatchOnSet.cs index bd38c07..20a43ce 100644 --- a/Svelto.ECS/Dispatcher/DispatchOnSet.cs +++ b/Svelto.ECS/Dispatcher/DispatchOnSet.cs @@ -23,11 +23,11 @@ namespace Svelto.ECS _subscribers.Invoke(_senderID, value); } + } - get - { - return _value; - } + public static implicit operator T(DispatchOnSet dispatch) + { + return dispatch._value; } public void NotifyOnValueSet(System.Action action) @@ -40,8 +40,8 @@ namespace Svelto.ECS _subscribers -= action; } - protected T _value; - readonly int _senderID; + protected T _value; + readonly int _senderID; WeakEvent _subscribers; } diff --git a/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs b/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs index f4e97fe..f5f26c4 100644 --- a/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs +++ b/Svelto.ECS/EnginesRoot.DoubleBufferedEntityViews.cs @@ -41,7 +41,11 @@ namespace Svelto.ECS { subitem.Value.Clear(); } + + item.Value.Clear(); } + + other.Clear(); } } } diff --git a/Svelto.ECS/EnginesRoot.Entities.cs b/Svelto.ECS/EnginesRoot.Entities.cs index 753b51f..34f05f6 100644 --- a/Svelto.ECS/EnginesRoot.Entities.cs +++ b/Svelto.ECS/EnginesRoot.Entities.cs @@ -87,7 +87,7 @@ namespace Svelto.ECS { if (entities.Has(entityID.entityID) == true) { - Utility.Console.LogError("Entity ".FastConcat(name, " with used ID is about to be built: ") + Svelto.Utilities.Console.LogError("Entity ".FastConcat(name, " with used ID is about to be built: ") .FastConcat(entityType) .FastConcat(" id: ") .FastConcat(entityID.entityID) diff --git a/Svelto.ECS/EnginesRoot.GenericEntityFactory.cs b/Svelto.ECS/EnginesRoot.GenericEntityFactory.cs index e81155e..9768d4c 100644 --- a/Svelto.ECS/EnginesRoot.GenericEntityFactory.cs +++ b/Svelto.ECS/EnginesRoot.GenericEntityFactory.cs @@ -25,9 +25,9 @@ namespace Svelto.ECS return _weakEngine.Target.BuildEntity(egid, implementors); } - public EntityStructInitializer BuildEntity(EGID egid, T descriptorEntity, object[] implementors) where T:IEntityDescriptor + public EntityStructInitializer BuildEntity(EGID egid, T entityDescriptor, object[] implementors) where T:IEntityDescriptor { - return _weakEngine.Target.BuildEntity(egid, descriptorEntity, implementors); + return _weakEngine.Target.BuildEntity(egid, entityDescriptor, implementors); } public EntityStructInitializer BuildEntity(int entityID, ExclusiveGroup groupID, T descriptorEntity, object[] implementors) where T:IEntityDescriptor diff --git a/Svelto.ECS/EnginesRoot.Submission.cs b/Svelto.ECS/EnginesRoot.Submission.cs index e0a6355..5db8dd5 100644 --- a/Svelto.ECS/EnginesRoot.Submission.cs +++ b/Svelto.ECS/EnginesRoot.Submission.cs @@ -18,10 +18,8 @@ namespace Svelto.ECS var entitiesOperations = _entitiesOperations.ToArrayFast(); for (int i = 0; i < _entitiesOperations.Count; i++) { -#if DEBUG try { -#endif switch (entitiesOperations[i].type) { case EntitySubmitOperationType.Swap: @@ -36,13 +34,15 @@ namespace Svelto.ECS RemoveGroupAndEntitiesFromDB(entitiesOperations[i].fromGroupID); break; } -#if DEBUG } catch (ECSException e) { - Utility.Console.LogError(e.Message.FastConcat(" ", entitiesOperations[i].trace)); - } + Svelto.Utilities.Console.LogError(e.Message.FastConcat(" ", entitiesOperations[i].trace)); + +#if DEBUG + throw; #endif + } } _entitiesOperations.FastClear(); @@ -128,7 +128,8 @@ namespace Svelto.ECS readonly FasterDictionary> _groupEntityDB; //for each entity view type, return the groups (dictionary of entities indexed by entity id) where they are found indexed by group id readonly Dictionary> _groupedGroups; //yes I am being sarcastic - readonly DoubleBufferedEntitiesToAdd>> _groupedEntityToAdd; + readonly DoubleBufferedEntitiesToAdd>> + _groupedEntityToAdd; readonly EntitySubmissionScheduler _scheduler; readonly FasterList _entitiesOperations; } diff --git a/Svelto.ECS/EntityViewUtility.cs b/Svelto.ECS/EntityViewUtility.cs index 261d9c3..ee99b03 100644 --- a/Svelto.ECS/EntityViewUtility.cs +++ b/Svelto.ECS/EntityViewUtility.cs @@ -53,7 +53,7 @@ static class EntityViewUtility #if DEBUG && !PROFILER else { - Utility.Console.Log(NULL_IMPLEMENTOR_ERROR.FastConcat("Type ", entityDescriptorName, " entityView ", + Svelto.Utilities.Console.Log(NULL_IMPLEMENTOR_ERROR.FastConcat("Type ", entityDescriptorName, " entityView ", entityBuilder.GetEntityType().ToString())); } #endif @@ -80,7 +80,7 @@ static class EntityViewUtility } #if DEBUG && !PROFILER if (component.numberOfImplementations > 1) - Utility.Console.LogError(DUPLICATE_IMPLEMENTOR_ERROR.FastConcat( + Svelto.Utilities.Console.LogError(DUPLICATE_IMPLEMENTOR_ERROR.FastConcat( "Component Type: ", fieldType.Name, " implementor: ", component.implementorType.ToString()) + diff --git a/Svelto.ECS/IEntitiesDB.cs b/Svelto.ECS/IEntitiesDB.cs index 340b3b4..6bc4536 100644 --- a/Svelto.ECS/IEntitiesDB.cs +++ b/Svelto.ECS/IEntitiesDB.cs @@ -57,7 +57,6 @@ namespace Svelto.ECS void ExecuteOnEntities(ExclusiveGroup groupID, EntitiesAction action) where T : IEntityStruct; void ExecuteOnEntities(int groupID, ref W value, EntitiesAction action) where T : IEntityStruct; void ExecuteOnEntities(ExclusiveGroup groupID, ref W value, EntitiesAction action) where T : IEntityStruct; - /// /// Execute an action on ALL the entities regardless the group. This function doesn't guarantee cache /// friendliness even if just EntityStructs are used. diff --git a/Svelto.ECS/IEntityFactory.cs b/Svelto.ECS/IEntityFactory.cs index 1ca9fa9..b55288d 100644 --- a/Svelto.ECS/IEntityFactory.cs +++ b/Svelto.ECS/IEntityFactory.cs @@ -49,6 +49,6 @@ namespace Svelto.ECS /// /// EntityStructInitializer BuildEntity(int entityID, ExclusiveGroup groupID, T descriptorEntity, object[] implementors) where T:IEntityDescriptor; - EntityStructInitializer BuildEntity(EGID egid, T descriptorEntity, object[] implementors) where T:IEntityDescriptor; + EntityStructInitializer BuildEntity(EGID egid, T entityDescriptor, object[] implementors) where T:IEntityDescriptor; } } diff --git a/Svelto.ECS/Sequencer.cs b/Svelto.ECS/Sequencer.cs index 700b41a..c22a2c4 100644 --- a/Svelto.ECS/Sequencer.cs +++ b/Svelto.ECS/Sequencer.cs @@ -10,7 +10,7 @@ namespace Svelto.ECS { if (ContainsKey(engine)) { - Utility.Console.LogError("can't hold multiple steps with the same engine as origin in a Sequencer"); + Svelto.Utilities.Console.LogError("can't hold multiple steps with the same engine as origin in a Sequencer"); } base.Add(engine, dictionary); } @@ -42,7 +42,7 @@ namespace Svelto.ECS var steps = (_steps[engine] as Dictionary[]>)[branch]; if (steps == null) - Utility.Console.LogError("selected steps not found in sequencer ".FastConcat(this.ToString())); + Svelto.Utilities.Console.LogError("selected steps not found in sequencer ".FastConcat(this.ToString())); for (var i = 0; i < steps.Length; i++) steps[i].Step(condition, id);