Beispiel #1
0
        private IEnumerator Play()
        {
            if (Delay > 0)
            {
                yield return(new WaitForSeconds(Delay / 1000));
            }

            var clip = Clip.GetRandom();

            if (clip != null)
            {
                //Source.PlayOneShot(Clip);
                Source.clip = clip;
                Source.Play();

                if (!Source.loop)
                {
                    DestroyObject(gameObject, clip.length);
                }
            }
            else
            {
                DestroyObject(gameObject);
            }
        }