using System; using Svelto.DataStructures; namespace Svelto.ECS.Internal { partial class EntitiesDB { public void ExecuteOnAllEntities(Action action) where T : struct, IEntityStruct { var type = typeof(T); if (_groupsPerEntity.TryGetValue(new RefWrapper(type), out var dictionary)) { foreach (var pair in dictionary) { var entities = (pair.Value as TypeSafeDictionary).GetValuesArray(out var innerCount); if (innerCount > 0) action(entities, new ExclusiveGroup.ExclusiveGroupStruct(pair.Key), innerCount, this); } } } public void ExecuteOnAllEntities (W value, Action action) where T : struct, IEntityStruct { var type = typeof(T); if (_groupsPerEntity.TryGetValue(new RefWrapper(type), out var dic)) { foreach (var pair in dic) { var entities = (pair.Value as TypeSafeDictionary).GetValuesArray(out var innerCount); if (innerCount > 0) action(entities, new ExclusiveGroup.ExclusiveGroupStruct(pair.Key), innerCount, this, value); } } } public void ExecuteOnAllEntities (ref W value, ExecuteOnAllEntitiesAction action) where T : struct, IEntityStruct { var type = typeof(T); if (_groupsPerEntity.TryGetValue(new RefWrapper(type), out var dic)) { foreach (var pair in dic) { var entities = (pair.Value as TypeSafeDictionary).GetValuesArray(out var innerCount); if (innerCount > 0) action(entities, new ExclusiveGroup.ExclusiveGroupStruct(pair.Key), innerCount, this, ref value); } } } } }