Beispiel #1
0
        public void SetPoolObjectToPool(PoolObject poolObject)
        {
            if (poolObject == null)
            {
                Debug.LogError("Pool object is null");
                return;
            }

            if (poolObject.Pool == null)
            {
                Debug.LogError("Pool is null");
                return;
            }

            if (!_poolDictionary.ContainsKey(poolObject.Pool.Name))
            {
                throw new ArgumentNullException($"{poolObject.Pool.Name} does not initialized.");
            }

            _poolDictionary[poolObject.Pool.Name].SetPoolObject(poolObject);
        }
Beispiel #2
0
        private IEnumerator GiveBackToPoolAfterSeconds(PoolObject go, float time)
        {
            yield return(new WaitForSeconds(time));

            SetPoolObjectToPool(go);
        }