void IPoolableRecycle.OnRecycle() { this.ReleaseState(ref this.resetState); this.ReleaseState(ref this.currentState); for (int i = 0; i < this.systems.Count; ++i) { this.systems[i].OnDeconstruct(); PoolSystems.Recycle(this.systems[i]); } PoolList <ISystem <TState> > .Recycle(ref this.systems); for (int i = 0; i < this.modules.Count; ++i) { this.modules[i].OnDeconstruct(); PoolModules.Recycle(this.modules[i]); } PoolList <IModule <TState> > .Recycle(ref this.modules); PoolDictionary <int, IList> .Recycle(ref this.entitiesCache); //PoolDictionary<EntityId, IEntity>.Recycle(ref this.entitiesDirectCache); PoolDictionary <int, IList> .Recycle(ref this.filtersCache); PoolDictionary <int, IComponents> .Recycle(ref this.componentsCache); PoolDictionary <int, int> .Recycle(ref this.capacityCache); }
void IPoolableRecycle.OnRecycle() { 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.freeze = false; this.capacity = 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); } }