/// <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); }
public override void OnEnter() { IMusicController musicController = MusicController.GetInstance(); if (musicController != null) { musicController.StopMusic(); } Continue(); }
public override void OnEnter() { IMusicController musicController = MusicController.GetInstance(); if (musicController != null) { float startTime = Mathf.Max(0, atTime); musicController.PlayMusic(musicClip, loop, fadeDuration, startTime); } Continue(); }
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"); } }
public override void OnEnter() { IMusicController musicController = MusicController.GetInstance(); if (musicController != null) { musicController.SetAudioVolume(volume, fadeDuration, () => { if (waitUntilFinished) { Continue(); } }); } if (!waitUntilFinished) { Continue(); } }
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(); } }
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!"); } }
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(); } }