Example #1
0
        /**
         * Returns the MusicController singleton instance.
         * Will create a MusicController game object if none currently exists.
         */
        public static MusicController GetInstance()
        {
            if (instance == null)
            {
                GameObject go = new GameObject("MusicController");
                DontDestroyOnLoad(go);
                instance = go.AddComponent<MusicController>();
            }

            return instance;
        }
Example #2
0
        public override void OnEnter()
        {
            MusicController musicController = MusicController.GetInstance();

            if (musicController != null)
            {
                musicController.SetAudioVolume(volume, fadeDuration, () => {
                    if (waitUntilFinished)
                    {
                        Continue();
                    }
                });
            }

            if (!waitUntilFinished)
            {
                Continue();
            }
        }
Example #3
0
        public override void OnEnter()
        {
            System.Action onComplete = () => {
                if (waitUntilFinished)
                {
                    Continue();
                }
            };

            MusicController musicController = MusicController.GetInstance();

            if (musicController != null)
            {
                musicController.SetAudioPitch(pitch, fadeDuration, onComplete);
            }

            if (!waitUntilFinished)
            {
                Continue();
            }
        }
Example #4
0
        public override void OnEnter()
        {
            if (soundClip == null)
            {
                Continue();
                return;
            }

            MusicController musicController = MusicController.GetInstance();

            if (musicController != null)
            {
                musicController.PlaySound(soundClip, volume);
            }

            if (waitUntilFinished)
            {
                Invoke("DoWait", soundClip.length);
            }
            else
            {
                Continue();
            }
        }