コード例 #1
0
ファイル: ArrayUtils.cs プロジェクト: serjabc/ecs-submodule
        public static void Copy <T, TCopy>(ME.ECS.Collections.BufferArray <T> fromArr, ref ME.ECS.Collections.BufferArray <T> arr, TCopy copy) where TCopy : IArrayElementCopy <T>
        {
            if (fromArr.arr == null)
            {
                if (arr.arr != null)
                {
                    for (int i = 0; i < arr.Length; ++i)
                    {
                        copy.Recycle(arr.arr[i]);
                    }
                    PoolArray <T> .Recycle(ref arr);
                }
                arr = BufferArray <T> .Empty;
                return;
            }

            if (arr.arr == null || fromArr.Length != arr.Length)
            {
                if (arr.arr != null)
                {
                    PoolArray <T> .Recycle(ref arr);
                }
                arr = PoolArray <T> .Spawn(fromArr.Length);
            }

            for (int i = 0; i < fromArr.Length; ++i)
            {
                copy.Copy(fromArr.arr[i], ref arr.arr[i]);
            }
        }
コード例 #2
0
ファイル: PoolComponents.cs プロジェクト: mmvlad/ecs
 public static void Recycle <TComponent>(ref TComponent[] list) where TComponent : class, IComponentBase
 {
     for (int i = 0; i < list.Length; ++i)
     {
         PoolComponents.Recycle(list[i]);
     }
     PoolArray <TComponent> .Recycle(ref list);
 }
コード例 #3
0
ファイル: ArrayUtils.cs プロジェクト: serjabc/ecs-submodule
        public static void Recycle <T, TCopy>(ref ME.ECS.Collections.BufferArray <T> item, TCopy copy) where TCopy : IArrayElementCopy <T>
        {
            for (int i = 0; i < item.Length; ++i)
            {
                copy.Recycle(item.arr[i]);
            }

            PoolArray <T> .Recycle(ref item);
        }
コード例 #4
0
        public static void Recycle <T, TCopy>(ref T[] item, TCopy copy) where TCopy : IArrayElementCopy <T>
        {
            if (item != null)
            {
                for (int i = 0; i < item.Length; ++i)
                {
                    copy.Recycle(item[i]);
                }

                PoolArray <T> .Recycle(ref item);
            }
        }
コード例 #5
0
        void IPoolableRecycle.OnRecycle()
        {
            PoolHashSetCopyable <EntityId> .Recycle(ref this.dataContains);

            PoolHashSetCopyable <Entity> .Recycle(ref this.data);

            PoolArray <IFilterNode> .Recycle(ref this.nodes);

            PoolHashSet <Entity> .Recycle(ref this.requestsRemoveEntity);

            PoolHashSet <Entity> .Recycle(ref this.requests);
        }
コード例 #6
0
ファイル: FiltersTree.cs プロジェクト: kraidiky/ecs-submodule
        public void Dispose()
        {
            for (int i = 0; i < this.itemsContains.Length; ++i)
            {
                this.itemsContains.arr[i].Dispose();
            }
            PoolArray <Item> .Recycle(ref this.itemsContains);

            for (int i = 0; i < this.itemsNotContains.Length; ++i)
            {
                this.itemsNotContains.arr[i].Dispose();
            }
            PoolArray <Item> .Recycle(ref this.itemsNotContains);
        }
コード例 #7
0
        internal void Deconstruct()
        {
            for (int i = 0; i < this.systems.Count; ++i)
            {
                this.systems.arr[i].OnDeconstruct();
                if (this.systems.arr[i] is ISystemFilter systemFilter)
                {
                    systemFilter.filter = null;
                }
                PoolSystems.Recycle(this.systems.arr[i]);
            }
            PoolArray <ISystemBase> .Recycle(ref this.systems);

            PoolArray <ModuleState> .Recycle(ref this.statesSystems);
        }
コード例 #8
0
        public static void Copy <T, TCopy>(T[] fromArr, ref T[] arr, TCopy copy) where TCopy : IArrayElementCopy <T>
        {
            if (fromArr == null)
            {
                if (arr != null)
                {
                    for (int i = 0; i < arr.Length; ++i)
                    {
                        copy.Recycle(arr[i]);
                    }

                    PoolArray <T> .Recycle(ref arr);
                }

                arr = null;
                return;
            }

            if (arr == null || fromArr.Length != arr.Length)
            {
                if (arr != null)
                {
                    ArrayUtils.Recycle(ref arr, copy);
                }
                arr = new T[fromArr.Length];
            }

            var cnt = arr.Length;

            for (int i = 0; i < fromArr.Length; ++i)
            {
                var isDefault = i >= cnt;

                T item = (isDefault ? default : arr[i]);
                copy.Copy(fromArr[i], ref item);
                arr[i] = item;
            }
        }
コード例 #9
0
ファイル: Archetypes.cs プロジェクト: Jlabarca/ecs
        public void OnRecycle()
        {
            PoolArray <Archetype> .Recycle(ref this.prevTypes);

            PoolArray <Archetype> .Recycle(ref this.types);
        }
コード例 #10
0
 public void Recycle()
 {
     PoolArray <ushort> .Recycle(ref this.values);
 }
コード例 #11
0
ファイル: FiltersTree.cs プロジェクト: kraidiky/ecs-submodule
 public void Dispose()
 {
     PoolArray <int> .Recycle(ref this.filters);
 }
コード例 #12
0
 public void OnRecycle()
 {
     PoolArray <uint> .Recycle(ref this.values);
 }
コード例 #13
0
ファイル: WorldComponents.cs プロジェクト: cleancoindev/ecs
        partial void OnRecycleComponents()
        {
            PoolArray <IComponents <TState> > .Recycle(ref this.componentsCache);

            //PoolDictionary<int, IComponents<TState>>.Recycle(ref this.componentsCache);
        }