Esempio n. 1
0
        public void PauseAndResumeVoiceTest()
        {
#if UNITY_EDITOR
            UnityEditor.EditorPrefs.SetInt("SimulateAssetBundles", 1);
#endif
            ResMgr.Init();

            var loader = ResLoader.Allocate();

            // 提前预加载,否则会进行异步加载
            loader.LoadSync <AudioClip>("sound1");

            AudioKit.Settings.IsVoiceOn.Value = true;

            AudioKit.PlayVoice("sound1");
            AudioKit.PauseVoice();

            Assert.IsFalse(AudioKit.VoicePlayer.AudioSource.isPlaying);

            AudioKit.ResumeVoice();

            Assert.IsTrue(AudioKit.VoicePlayer.AudioSource.isPlaying);

            loader.Recycle2Cache();
            loader = null;
        }