Example #1
0
 public static void Recycle <TComponent>(HashSet <TComponent> list) where TComponent : class, IComponentBase
 {
     foreach (var item in list)
     {
         PoolComponents.Recycle(item);
     }
     list.Clear();
 }
Example #2
0
 public static void Recycle <TComponent>(ME.ECS.Collections.ListCopyable <TComponent> list) where TComponent : class, IComponentBase
 {
     for (int i = 0; i < list.Count; ++i)
     {
         PoolComponents.Recycle(list[i], list[i].GetType());
     }
     list.Clear();
 }
Example #3
0
 public static void Recycle <TComponent>(IList <TComponent> list) where TComponent : class, IComponentBase
 {
     for (int i = 0; i < list.Count; ++i)
     {
         PoolComponents.Recycle(list[i], list[i].GetType());
     }
     list.Clear();
 }
Example #4
0
 public static void Recycle <TComponent>(ref TComponent[] list) where TComponent : class, IComponentBase
 {
     for (int i = 0; i < list.Length; ++i)
     {
         PoolComponents.Recycle(list[i]);
     }
     PoolArray <TComponent> .Recycle(ref list);
 }
Example #5
0
        public void RemoveAll(Entity entity)
        {
            List <IComponent <TState, TEntity> > list;

            if (this.dic.TryGetValue(entity.id, out list) == true)
            {
                PoolComponents.Recycle(list);
                list.Clear();
            }
        }
Example #6
0
        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;
        }
Example #7
0
 public void RemoveAll <TComponent>() where TComponent : class, IComponentBase
 {
     foreach (var item in this.dic)
     {
         var list = item.Value;
         for (int i = 0; i < list.Count; ++i)
         {
             var listItem = list[i];
             if (listItem is TComponent listItemComponent)
             {
                 PoolComponents.Recycle(listItemComponent);
                 list.RemoveAt(i);
                 --i;
             }
         }
     }
 }
Example #8
0
 public static void Recycle <T>(ref T system) where T : class, IComponentBase
 {
     PoolComponents.Recycle(system);
     system = null;
 }