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

            return(instance);
        }
Esempio n. 2
0
        public override void OnEnter()
        {
            IMusicController musicController = MusicController.GetInstance();

            if (musicController != null)
            {
                musicController.StopMusic();
            }

            Continue();
        }
Esempio n. 3
0
        public override void OnEnter()
        {
            IMusicController musicController = MusicController.GetInstance();

            if (musicController != null)
            {
                float startTime = Mathf.Max(0, atTime);
                musicController.PlayMusic(musicClip, loop, fadeDuration, startTime);
            }

            Continue();
        }
Esempio n. 4
0
        private String StartPlaylist(String playlist, bool random)
        {
            IMusicController controller = ConfigManager.FindAllComponentsOfType <IMusicController>().FirstOrDefault(c => c.GetPlaylists().Contains(playlist));

            if (controller == null || !controller.TryStartPlaylist(playlist, random))
            {
                return("Could not find that playlist. Please ask for a different playlist, or ask me for one of the available playlists.");
            }
            else
            {
                return("O K");
            }
        }
Esempio n. 5
0
        public override void OnEnter()
        {
            IMusicController musicController = MusicController.GetInstance();

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

            if (!waitUntilFinished)
            {
                Continue();
            }
        }
Esempio n. 6
0
        public override void OnEnter()
        {
            System.Action onComplete = () => {
                if (waitUntilFinished)
                {
                    Continue();
                }
            };

            IMusicController musicController = MusicController.GetInstance();

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

            if (!waitUntilFinished)
            {
                Continue();
            }
        }
Esempio n. 7
0
        public override String Speak()
        {
            base.Speak();
            ConversationIsOver = true;

            // Turn on the light switch
            ILightSwitchController lightSwitchControl = ConfigManager.FindAllComponentsOfType <ILightSwitchController>().FirstOrDefault(s => s.Name.Contains("Christmas"));

            lightSwitchControl.TurnOn();


            // Start the music!
            IMusicController controller = ConfigManager.FindAllComponentsOfType <IMusicController>().FirstOrDefault(c => c.GetPlaylists().Contains("Christmas"));

            if (controller == null || !controller.TryStartPlaylist("Christmas", true))
            {
                return("I'm sorry, I could not find the music playlist.");
            }
            else
            {
                return("Merry Christmas!");
            }
        }
Esempio n. 8
0
        public override void OnEnter()
        {
            if (soundClip == null)
            {
                Continue();
                return;
            }

            IMusicController musicController = MusicController.GetInstance();

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

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