コード例 #1
0
ファイル: SoundView.cs プロジェクト: hannahli23/runityscape
        /// <summary>
        /// Plays the clip then destroys it.
        /// </summary>
        /// <param name="resourceLocation">The resource location.</param>
        /// <returns></returns>
        private IEnumerator PlayThenDestroy(string resourceLocation)
        {
            ClipView clip = ObjectPoolManager.Instance.Get <ClipView>(clipPrefab);

            clip.Clip   = Sound[resourceLocation];
            clip.Volume = SOUND_VOLUME;
            oneShotHolder.Add(clip);
            while (clip.IsPlaying)
            {
                yield return(null);
            }
            oneShotHolder.Stop(clip.GetInstanceID());
            yield break;
        }