public virtual void ReturnToPool(TargetReticle obj) { if (this.deactivatePoolObjectDelegate != null) { this.deactivatePoolObjectDelegate(obj); } this.pool.Enqueue(obj); }
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"); }