Exemplo n.º 1
0
        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]);
            }
        }
Exemplo n.º 2
0
        void IPoolableSpawn.OnSpawn()
        {
            this.requests = PoolHashSet <Entity> .Spawn(Filter <TState, TEntity> .REQUESTS_CAPACITY);

            this.requestsRemoveEntity = PoolHashSet <Entity> .Spawn(Filter <TState, TEntity> .REQUESTS_CAPACITY);

            this.nodes = PoolArray <IFilterNode> .Spawn(Filter <TState, TEntity> .NODES_CAPACITY);

            this.data = PoolHashSetCopyable <Entity> .Spawn();

            this.dataContains = PoolHashSetCopyable <EntityId> .Spawn();
        }
Exemplo n.º 3
0
 public void Initialize(int capacity)
 {
     this.buckets = PoolArray <Bucket> .Spawn(capacity);
 }
Exemplo n.º 4
0
 partial void OnSpawnComponents()
 {
     this.componentsCache = PoolArray <IComponents <TState> > .Spawn(World <TState> .COMPONENTS_CAPACITY); //PoolDictionary<int, IComponents<TState>>.Spawn(World<TState>.COMPONENTS_CAPACITY);
 }