private void RemoveObject()
        {
            if (this.destroyClip != null)
            {
                AudioPlayer.Play(this.destroyClip);
            }

            PoolManager.Despawn(this.gameObject);
        }
Example #2
0
 public void Despawn()
 {
     StopAllCoroutines();
     if (PoolManager.HasPool(this.gameObject))
     {
         PoolManager.Despawn(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Example #3
0
        public void Despawn(GameObject spawnedObject)
        {
            if (spawnedObject.activeSelf)
            {
                PoolManager.Despawn(spawnedObject);
            }

            if (this.spawnedObjects.Contains(spawnedObject))
            {
                this.spawnedObjects.Remove(spawnedObject);
            }
        }
Example #4
0
        public void DespawnAll()
        {
            for (int i = 0; i < this.spawnedObjects.Count; i++)
            {
                var spawnedObject = this.spawnedObjects[i];
                if (spawnedObject.activeSelf)
                {
                    PoolManager.Despawn(spawnedObject);
                }
            }

            this.spawnedObjects.Clear();
        }