Exemple #1
0
 public void Push(IPoolElement obj)
 {
     if (obj is T t)
     {
         Push(t);
     }
     else
     {
         throw new InvalidCastException("Can not push object from type: " + obj.GetType());
     }
 }
Exemple #2
0
        public IPoolElement[] GetElements(int count, Transform newParent = null)
        {
            var result = new IPoolElement[count];

            for (int i = 0; i < result.Length; i++)
            {
                result[i] = GetElement(newParent);
            }

            return(result);
        }