using System.Collections; using System.Collections.Generic; using UnityEngine; public class SoundBox : MonoBehaviour { AudioSource Sound; void Awake() { Sound = GetComponent(); } public void PlaySound(AudioClip Clip,float v,Vector3 tr) { transform.position = tr; Sound.clip = Clip; Sound.mute = false; Sound.volume = v; Sound.Play(); } public void PlaySound(AudioClip Clip, float v) { Sound.clip = Clip; Sound.mute = false; Sound.volume = v; Sound.Play(); } void Update() { if(gameObject.activeSelf && !(Sound.isPlaying)) { SoundManager.Instance.EndSound(this); } } }