コード例 #1
0
        public void Play(ClipId id = DefaultClip)
        {
            var clip = _audioClips.Find(clip => clip.name == id.ToString());

            if (clip != null)
            {
                _audioSource.Stop();

                _audioSource.clip = clip;
                _audioSource.Play();
            }
            else
            {
                Debug.LogError($"Can't find clip with id {id}");
            }
        }
コード例 #2
0
 private static string GetPathToAudioClip(ClipId id)
 {
     return($"Audio/{id}");
 }