private void RemoveObject() { if (this.destroyClip != null) { AudioPlayer.Play(this.destroyClip); } PoolManager.Despawn(this.gameObject); }
public void Despawn() { StopAllCoroutines(); if (PoolManager.HasPool(this.gameObject)) { PoolManager.Despawn(this.gameObject); } else { Destroy(this.gameObject); } }
public void Despawn(GameObject spawnedObject) { if (spawnedObject.activeSelf) { PoolManager.Despawn(spawnedObject); } if (this.spawnedObjects.Contains(spawnedObject)) { this.spawnedObjects.Remove(spawnedObject); } }
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(); }