Exemplo n.º 1
0
Arquivo: World.cs Projeto: PushoN/ecs
        void IPoolableSpawn.OnSpawn()
        {
            this.systems = PoolList <ISystem <TState> > .Spawn(100);

            this.modules = PoolList <IModule <TState> > .Spawn(100);

            this.entitiesCache = PoolDictionary <int, IList> .Spawn(100);

            //this.entitiesDirectCache = PoolDictionary<EntityId, IEntity>.Spawn(100);
            this.filtersCache = PoolDictionary <int, IList> .Spawn(100);

            this.componentsCache = PoolDictionary <int, IComponents> .Spawn(100);

            this.capacityCache = PoolDictionary <int, int> .Spawn(100);
        }
Exemplo n.º 2
0
        public void CopyFrom(Components <TEntity, TState> other)
        {
            if (this.dic != null)
            {
                foreach (var item in this.dic)
                {
                    //PoolComponents.Recycle(item.Value);
                    PoolList <IComponent <TState, TEntity> > .Recycle(item.Value);
                }
                PoolDictionary <EntityId, List <IComponent <TState, TEntity> > > .Recycle(ref this.dic);
            }
            this.dic = PoolDictionary <EntityId, List <IComponent <TState, TEntity> > > .Spawn(this.capacity);

            foreach (var item in other.dic)
            {
                var newList = PoolList <IComponent <TState, TEntity> > .Spawn(item.Value.Capacity);

                newList.AddRange(item.Value);
                this.dic.Add(item.Key, newList);
            }
        }
Exemplo n.º 3
0
 public void Initialize(int capacity)
 {
     this.capacity = capacity;
     this.dic      = PoolDictionary <EntityId, List <IComponent <TState, TEntity> > > .Spawn(capacity);
 }