Esempio n. 1
0
File: World.cs Progetto: PushoN/ecs
        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);
        }
Esempio n. 2
0
 public static void Recycle <T>(ref T system) where T : class, IModuleBase
 {
     PoolModules.Recycle(system);
     system = null;
 }