示例#1
0
        public IEnumerator ShuffleCoroutine(SFXSet set)
        {
            int index = GetRandomIndex();

            //Make up one repeat count, otherwise first song repeats one less than subsequent songs.
            waitingForNextSong = true;

            while (shuffling)
            {
                if (playsRemaining <= 0)
                {
                    index          = GetRandomIndex();
                    playsRemaining = playCount;
                }

                while (waitingForNextSong == true)
                {
                    if (audioSource.isPlaying == false)
                    {
                        Play(index);
                        waitingForNextSong = false;
                    }
                    yield return(null);
                }

                waitingForNextSong = true;
                yield return(bgmLengths[index]);

                if (playsRemaining > 0)
                {
                    playsRemaining--;
                }
            }
        }