void Update() { if (!audioSource.isPlaying) { poolItem.ReturnToPool(); } }
public void Explode(GameObject instigator, bool SpawnFX = true) { if (SpawnFX && DestroyFXPrefab != null) { var explosion = PoolManager.Instance.GetInstance(DestroyFXPrefab); explosion.transform.position = transform.position; explosion.transform.rotation = transform.rotation; } GameManager.Instance.OnDestructibleExplode(this, instigator); if (poolItem != null) { poolItem.ReturnToPool(); } else { Destroy(gameObject); } }
void Destroy() => poolItem.ReturnToPool();