void Update() { if (Input.GetMouseButtonDown(0)) { Sonos.PlayAt(sfx, transform); } if (Input.GetMouseButtonDown(1)) { Sonos.Play(sfx); } if (Input.GetMouseButtonDown(2)) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } if (Input.mouseScrollDelta.y > 0f) // forward //Sonos.VolumeMaster += 0.1f; //Sonos.instance.Volume[(int)AudioType.Music] += 0.1f; { Sonos.ChangeVolume(AudioType.Effect, 0.1f); } else if (Input.mouseScrollDelta.y < 0f) // backwards //Sonos.VolumeMaster -= 0.1f; //Sonos.instance.Volume[(int)AudioType.Music] -= 0.1f; { Sonos.ChangeVolume(AudioType.Effect, -0.1f); } }
void Awake() { //Singleton Pattern DontDestroyOnLoad(gameObject); if (instance == null) { instance = this; } else { Destroy(gameObject); return; } //Volume Types setup as 1f each _volumeMaster = 1f; foreach (var aType in (AudioType[])Enum.GetValues(typeof(AudioType))) { Volume.Add(1f); } //Set up the initial pool for (int i = 0; i < playerPoolPreferredSize; i++) { AddPlayerToPool(); } //Subscribe to Scene management event SceneManager.sceneLoaded += OnSceneLoaded; }
public async void Request(SpeechRecognitionResult Rule) { switch (Rule.Constraint.Tag) { case "TurnOnSonos": Sonos.Play(); break; case "TurnOffSonos": Sonos.Pause(); break; case "NextSong": Sonos.Next(); break; case "PreviousSong": Sonos.Previous(); break; case "SoundUp": int volume = await Sonos.GetVolume() + 10; if (volume > 100) { volume = 100; } Sonos.SetVolume(volume); break; case "SoundDown": int volum = await Sonos.GetVolume() - 10; if (volum < 0) { volum = 0; } Sonos.SetVolume(volum); break; case "TurnOffLight": Hue.TurnOffLights(); break; case "TurnOnLight": Hue.TurnOnLights(); break; case "Fort": Sonos.SetVolume(100); break; } }
private void OnEnable() { volumeMaster.value = Sonos.VolumeMaster; //Debug.Log("volumeMaster.value: "+volumeMaster.value); volumeMaster.onValueChanged.AddListener(delegate { volumeMaster_onValueChanged(); }); volumeBGM.value = Sonos.GetVolume(AudioType.Music); //Debug.Log("volumeBGM.value: "+volumeBGM.value); volumeBGM.onValueChanged.AddListener(delegate { volumeBGM_onValueChanged(); }); volumeSFX.value = Sonos.GetVolume(AudioType.Effect); //Debug.Log("volumeSFX.value: "+volumeSFX.value); volumeSFX.onValueChanged.AddListener(delegate { volumeSFX_onValueChanged(); }); }
void Start() { Sonos.Play(bgm); Sonos.PlayAt(missileLoop, transform); Sonos.VolumeMaster = 0.5f; }
public void volumeSFX_onValueChanged() { Sonos.SetVolume(AudioType.Effect, volumeSFX.value); }
public void volumeBGM_onValueChanged() { Sonos.SetVolume(AudioType.Music, volumeBGM.value); }
public void Unpack(Sonos _audioManager) { audioManager = _audioManager; audioManager.OnVolumeChanged += AudioSetVolume; }