diff --git a/src/Consts.cs b/src/Consts.cs index 307b30a..8100e90 100644 --- a/src/Consts.cs +++ b/src/Consts.cs @@ -8,6 +8,7 @@ public const string DEBUG_PREFIX = "[DEBUG] "; public const string DEBUG_WARNING_TAG = "WARNING"; public const string DEBUG_ERROR_TAG = "ERROR"; + public const string DEBUG_PASS_TAG = "PASS"; public const string PRE_BEGIN_LAYER = nameof(PRE_BEGIN_LAYER); public const string BEGIN_LAYER = nameof(BEGIN_LAYER); diff --git a/src/Debug/EcsDebug.cs b/src/Debug/EcsDebug.cs index 9443fd9..de0dba5 100644 --- a/src/Debug/EcsDebug.cs +++ b/src/Debug/EcsDebug.cs @@ -33,6 +33,7 @@ namespace DCFApixels.DragonECS { public const string WARNING_TAG = EcsConsts.DEBUG_WARNING_TAG; public const string ERROR_TAG = EcsConsts.DEBUG_ERROR_TAG; + public const string PASS_TAG = EcsConsts.DEBUG_PASS_TAG; public static void Set() where T : DebugService, new() => DebugService.Set(); public static void Set(DebugService service) => DebugService.Set(service); @@ -40,6 +41,7 @@ namespace DCFApixels.DragonECS [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void PrintWarning(object v) => Print(EcsConsts.DEBUG_WARNING_TAG, v); public static void PrintError(object v) => Print(EcsConsts.DEBUG_ERROR_TAG, v); + public static void PrintPass(object v) => Print(EcsConsts.DEBUG_PASS_TAG, v); public static void Print() { #if !DISABLE_DRAGONECS_DEBUGGER @@ -156,6 +158,9 @@ namespace DCFApixels.DragonECS case EcsDebug.WARNING_TAG: Console.ForegroundColor = ConsoleColor.Yellow; break; + case EcsDebug.PASS_TAG: + Console.ForegroundColor = ConsoleColor.Green; + break; } Console.WriteLine($"[{tag}] {v}"); Console.ForegroundColor = color; diff --git a/src/EcsWorld.cs b/src/EcsWorld.cs index 544f4e8..3dc275d 100644 --- a/src/EcsWorld.cs +++ b/src/EcsWorld.cs @@ -469,11 +469,30 @@ namespace DCFApixels.DragonECS { list.Clear(); var itemsCount = GetComponentsCount(entityID); - - for (var i = 0; i < _pools.Length; i++) + for (var i = 0; i < _poolsCount; i++) { if (_pools[i].Has(entityID)) + { + itemsCount--; list.Add(_pools[i].GetRaw(entityID)); + if (itemsCount <= 0) + break; + } + } + } + public void GetComponentTypes(int entityID, HashSet typeSet) + { + typeSet.Clear(); + var itemsCount = GetComponentsCount(entityID); + for (var i = 0; i < _poolsCount; i++) + { + if (_pools[i].Has(entityID)) + { + itemsCount--; + typeSet.Add(_pools[i].ComponentType); + if (itemsCount <= 0) + break; + } } } #endregion