private void OnTriggerExit(Collider collider) { if (collider.gameObject.CompareTag("Player")) { pipePool.ReturnToPool(this); } }
/// <summary> /// Destroy all pipes and stop spawning pipes. /// </summary> public void DestroyAllPipes() { canSpawn = false; for (int i = pipes.Count - 1; i >= 0; i--) { Pipe pipe = pipes[i]; pipes.RemoveAt(i); pipePool.ReturnToPool(pipe); } }