Exemple #1
0
        public void TryPoolObject(Resetter resetter)
        {
            if (!pool.Contains(resetter))
            {
                return;
            }

            resetter.gameObject.SetActive(false);

            resetter.transform.localPosition = spawnLocalPosition;

            freePooledObjectCount++;
        }
Exemple #2
0
        public void SpawnNextObject()
        {
            if (this.enabled && HasFreePooledObject)
            {
                Resetter resetter = pool.FirstOrDefault(resetter => resetter.gameObject.activeSelf == false);

                if (resetter != null)
                {
                    resetter.Reset();
                    resetter.gameObject.SetActive(true);

                    freePooledObjectCount--;
                }
            }
        }