Esempio n. 1
0
 public virtual void ReturnToPool(TargetReticle obj)
 {
     if (this.deactivatePoolObjectDelegate != null)
     {
         this.deactivatePoolObjectDelegate(obj);
     }
     this.pool.Enqueue(obj);
 }
Esempio n. 2
0
 public virtual TargetReticle GetFromPool(bool allowBeyondCapacity)
 {
     if (this.pool.Count != 0)
     {
         TargetReticle targetReticle = this.pool.Dequeue();
         if (this.activatePoolObjectDelegate != null)
         {
             this.activatePoolObjectDelegate(targetReticle);
         }
         return(targetReticle);
     }
     if (allowBeyondCapacity)
     {
         return(this.CreateNew());
     }
     throw new Exception("No more pool objects available");
 }