コード例 #1
0
        IEnumerator DoPlay()
        {
            if (startDelay > 0f)
            {
                yield return(new WaitForSeconds(startDelay));
            }

            if (nextDelayMin == nextDelayMax)
            {
                if (useShuffle)
                {
                    while (true)
                    {
                        for (int i = 0; i < frames.Length; i++)
                        {
                            sprite.sprite = frames[i];
                            yield return(new WaitForSeconds(nextDelayMin));
                        }

                        ArrayUtil.Shuffle(frames);
                    }
                }
                else
                {
                    while (true)
                    {
                        sprite.sprite = frames[Random.Range(0, frames.Length)];
                        yield return(new WaitForSeconds(nextDelayMin));
                    }
                }
            }
            else
            {
                if (useShuffle)
                {
                    while (true)
                    {
                        for (int i = 0; i < frames.Length; i++)
                        {
                            sprite.sprite = frames[i];
                            yield return(new WaitForSeconds(Random.Range(nextDelayMin, nextDelayMax)));
                        }

                        ArrayUtil.Shuffle(frames);
                    }
                }
                else
                {
                    while (true)
                    {
                        sprite.sprite = frames[Random.Range(0, frames.Length)];
                        yield return(new WaitForSeconds(Random.Range(nextDelayMin, nextDelayMax)));
                    }
                }
            }
        }
コード例 #2
0
        public void Play()
        {
            mActive = true;

            if (useShuffle)
            {
                ArrayUtil.Shuffle(frames);
            }

            if (mRout == null)
            {
                mRout = StartCoroutine(DoPlay());
            }
        }
コード例 #3
0
 public void Shuffle()
 {
     ArrayUtil.Shuffle(mItems, 0, mCount);
 }