public IPoolable RetrieveFromPool(BulletTypes bulletTypes) { if (pulledBullet.ContainsKey(bulletTypes) && pulledBullet[bulletTypes].Count > 0) { IPoolable toRet = pulledBullet[bulletTypes].Pop(); toRet.GetGameObject.transform.SetParent(null); toRet.GetGameObject.SetActive(true); toRet.DePooled(); //Just in case the object wants to be alerted return(toRet); } return(null); }
public IPoolable RetrieveFromPool(string objectName) { if (pooledObjects.ContainsKey(objectName) && pooledObjects[objectName].Count > 0) { IPoolable toRet = pooledObjects[objectName].Pop(); toRet.GetGameObject.transform.SetParent(null); toRet.GetGameObject.SetActive(true); toRet.DePooled(); return(toRet); } return(null); }