public void Initialize()
 {
     if (this.globalEventLogicItems == null)
     {
         this.globalEventLogicItems = PoolListCopyable <GlobalEventFrameItem> .Spawn(10);
     }
     if (this.globalEventLogicEvents == null)
     {
         this.globalEventLogicEvents = PoolHashSetCopyable <long> .Spawn();
     }
 }
Esempio n. 2
0
 public void Initialize(int capacity)
 {
     if (this.data == null)
     {
         this.data = PoolHashSetCopyable <KeyValuePair> .Spawn(capacity);
     }
     if (this.index == null)
     {
         this.index = PoolHashSetCopyable <long> .Spawn(capacity);
     }
 }
Esempio n. 3
0
        public static void Recycle <T, TCopy>(ref HashSetCopyable <T> list, TCopy copy) where TCopy : IArrayElementCopy <T>
        {
            if (list != null)
            {
                foreach (var item in list)
                {
                    copy.Recycle(item);
                }

                PoolHashSetCopyable <T> .Recycle(ref list);
            }
        }
Esempio n. 4
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);
        }
Esempio n. 5
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();
        }
Esempio n. 6
0
        public static void Copy <T>(HashSetCopyable <T> fromArr, ref HashSetCopyable <T> arr) where T : struct
        {
            if (fromArr == null)
            {
                if (arr != null)
                {
                    PoolHashSetCopyable <T> .Recycle(ref arr);
                }

                arr = null;
                return;
            }

            if (arr == null)
            {
                arr = PoolHashSetCopyable <T> .Spawn(fromArr.Count);
            }

            arr.CopyFrom(fromArr);
        }
Esempio n. 7
0
        public static void Copy <T, TCopy>(HashSetCopyable <T> fromArr, ref HashSetCopyable <T> arr, TCopy copy) where T : struct where TCopy : IArrayElementCopy <T>
        {
            if (fromArr == null)
            {
                if (arr != null)
                {
                    arr.Clear(copy);
                    PoolHashSetCopyable <T> .Recycle(ref arr);
                }

                arr = null;
                return;
            }

            if (arr == null)
            {
                arr = PoolHashSetCopyable <T> .Spawn();
            }

            arr.CopyFrom(fromArr, copy);
        }
Esempio n. 8
0
        public void CopyFrom(Filter <TState, TEntity> other)
        {
            this.id         = other.id;
            this.name       = other.name;
            this.nodesCount = other.nodesCount;

            ArrayUtils.Copy(other.nodes, ref this.nodes);

            if (this.data != null)
            {
                PoolHashSetCopyable <Entity> .Recycle(ref this.data);
            }
            this.data = PoolHashSetCopyable <Entity> .Spawn(other.data.Count);

            this.data.CopyFrom(other.data);

            if (this.dataContains != null)
            {
                PoolHashSetCopyable <EntityId> .Recycle(ref this.dataContains);
            }
            this.dataContains = PoolHashSetCopyable <EntityId> .Spawn(other.dataContains.Count);

            this.dataContains.CopyFrom(other.dataContains);
        }
        public void DeInitialize()
        {
            PoolListCopyable <GlobalEventFrameItem> .Recycle(ref this.globalEventLogicItems);

            PoolHashSetCopyable <long> .Recycle(ref this.globalEventLogicEvents);
        }