Files
2025-05-29 22:31:40 +03:00

28 lines
576 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StopSound : MonoBehaviour
{
[SerializeField] private PlaySound _playSound;
private void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "Player" && !_playSound.ClipStopped)
{
StopThisSound();
}
}
public void StopThisSound()
{
_playSound.ClipStopped = true;
}
public void StopThisSoundImmediately()
{
_playSound.audioSource.Stop();
_playSound.ClipStopped = true;
}
}