diff --git a/src/EcsPipeline.cs b/src/EcsPipeline.cs index 98ea570..bc628a4 100644 --- a/src/EcsPipeline.cs +++ b/src/EcsPipeline.cs @@ -37,11 +37,30 @@ namespace DCFApixels.DragonECS } #endregion - #region Runners - public T[] GetSystems() where T : IEcsProcess + #region GetSystems + public T[] GetSystems() { - return _allSystems.Where(o => o is T).Select(o => (T)o).ToArray(); + return _allSystems.OfType().ToArray(); } + public int GetSystemsNoAllock(ref T[] array) + { + int count = 0; + for (int i = 0; i < _allSystems.Length; i++) + { + if (_allSystems is T targetSystem) + { + if (array.Length <= count) + { + Array.Resize(ref array, array.Length << 1); + } + array[count++] = targetSystem; + } + } + return count; + } + #endregion + + #region Runners public T GetRunner() where T : IEcsProcess { Type type = typeof(T);