TO SQUASH: Fixed issue with bar hit sound being played multiple times.

This commit is contained in:
2026-08-05 01:48:00 -04:00
parent 8fdefdc1a6
commit 475defbd6b
+3
View File
@@ -17,8 +17,11 @@ public class BallBase : MonoBehaviour
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.CompareTag("Bar"))
{
if (!audioSource.isPlaying)
{
audioSource.PlayOneShot(hitSound);
}
// Destroy all bar segments when the ball hits a bar.
var barSegments = GameObject.FindGameObjectsWithTag("Bar");