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); } }
public void Initialize(int capacity) { this.capacity = capacity; this.dic = PoolDictionary <EntityId, List <IComponent <TState, TEntity> > > .Spawn(capacity); }