void CheckSoundType()
 {
     if (mySoundType == SoundType.Music)
     {
         SoundHandler.PlayMusic(myFileName);
     }
     if (mySoundType == SoundType.ShortMusic)
     {
         SoundHandler.PlayShortMusic(myFileName);
     }
     if (mySoundType == SoundType.Effect)
     {
         SoundHandler.PlayEffect(myFileName);
     }
 }
Пример #2
0
        IEnumerator Start()
        {
            startUI.gameObject.SetActive(true);
            loadingText.text = "按任意键...";
            GameObject soundManager = Instantiate(Resources.Load("SoundManager") as GameObject, transform);

            yield return(SoundManager.ins.LoadAllSound());

            SoundHandler.PlayMusic("Toby Fox - sans");

            for (int i = 0; i < endGameList.Count; i++)
            {
                endGameList[i].gameObject.SetActive(false);
            }
            int count = 1;

            for (int i = 0; i < startGameList.Count; i++)
            {
                startGameList[i].gameObject.SetActive(true);
                if (i == 0)
                {
                    startGameList[i].color = new Color(1, 1, 1, 1);
                }
                else
                {
                    startGameList[i].color = new Color(1, 1, 1, 0);
                }
            }

            yield return(null);

            while (count < startGameList.Count)
            {
                while (!Input.anyKeyDown)
                {
                    yield return(null);
                }

                loadingText.text = "";

                while (startGameList[count].color.a < 1)
                {
                    startGameList[count].color = new Color(1, 1, 1, Mathf.Clamp01(startGameList[count].color.a + Time.deltaTime));
                    yield return(null);
                }
                count++;
            }

            while (!Input.anyKeyDown)
            {
                yield return(null);
            }

            loadingText.text = "载入中...";
            LoadScene();

            while (!isFinishedLoadScene)
            {
                yield return(null);
            }
        }