using UnityEngine; namespace ClusterVR.CreatorKit.World.Implements.Speaker { [RequireComponent(typeof(AudioSource))] public sealed class Speaker : MonoBehaviour, ISpeaker { AudioSource audioSource; [SerializeField] SpeakerType speakerType; public AudioSource AudioSource { get { if (audioSource == null) { audioSource = GetComponent(); Initialize(); } return audioSource; } } public SpeakerType SpeakerType => speakerType; void Start() { audioSource = GetComponent(); Initialize(); } void Initialize() { audioSource.enabled = true; audioSource.loop = true; } void Reset() { AudioSource.dopplerLevel = 0.0f; } } }