public void SetVolumeMusic(float vol) { string vcaPath = "vca:/MusicVCA"; FMOD.Studio.VCA vca = FMODUnity.RuntimeManager.GetVCA(vcaPath); vca.setVolume(vol); }
// função para controlar volume do SFX no jogo (volume min=0 max=1) void VolumeUI_MUSIC(float volume) { string vcaPath = "vca:/ui music"; FMOD.Studio.VCA vca = FMODUnity.RuntimeManager.GetVCA(vcaPath); vca.setVolume(volume); }
// função para controlar volume da UI (volume min=0 max=1) void VolumeSFX(float volume) { string vcaPath = "vca:/sfx"; FMOD.Studio.VCA vca = FMODUnity.RuntimeManager.GetVCA(vcaPath); vca.setVolume(volume); }
//--------------------------------------- // good to know: linear-> db conversion // float db = linear > 0 ? 20.0f * Mathf.Log10(linear * Mathf.Sqrt(2.0f)) : -80.0f; // public void SetVolumeFx(float vol) { // Debug.Log("vol: " + vol); string vcaPath = "vca:/FXVCA"; FMOD.Studio.VCA vca = FMODUnity.RuntimeManager.GetVCA(vcaPath); vca.setVolume(vol); }
// Update is called once per frame void Update() { // Test event if (Input.GetKeyDown(KeyCode.Alpha9)) { FMODUnity.RuntimeManager.PlayOneShot(TestEventName, this.transform.position); } // Volume control if (Input.GetKeyDown(KeyCode.Alpha1)) { sfx_volume = Mathf.Clamp(sfx_volume - 0.1f, 0.0f, 1.0f); VCA_SFX.setVolume(sfx_volume); VCA_Music.setVolume(sfx_volume); } if (Input.GetKeyDown(KeyCode.Alpha2)) { sfx_volume = Mathf.Clamp(sfx_volume + 0.1f, 0.0f, 1.0f); VCA_SFX.setVolume(sfx_volume); VCA_Music.setVolume(sfx_volume); } }
public void MusicVolume(float val) { vca_mus.setVolume(val); PlayerPrefs.SetFloat("MusicVolume", val); }
public void SetFXVolume(float volume) { volumeFX = volume; FXVCA.setVolume(volume); }
public void SetMusicVolume(float volume) { volumeMusik = volume; MusicVCA.setVolume(volume); }
public void SetVoVolume(float volume) { voVca.setVolume(volume); }
public void SetAtVolume(float volume) { atVca.setVolume(volume); }
/// <summary> /// Мы можем менять громкость каждый фрейм, но правельнее будет менять громкость только в случае ее изменения (функцию ValueChange) /// </summary> /// //void Update() //{ // vcaController.getVolume(out vcaVolume); // vcaController.setVolume(ourSlider.value); //} public void VCAVolumeChange() // Создаем новую функцию, которую нужно обязательно подключить в компоненте слайдера On Value Changed { vcaController.setVolume(ourSlider.value); // устанавливаем громкость шины VCA в такое же значение, как значение нашего слайдера }
public void SetMuVolume(float volume) { muVca.setVolume(volume); }
public void SetMainVolume(float volume) { mainVca.setVolume(volume); }
void Update() { volume = Mathf.Pow(10.0f, vcaVolume / 20f); vca.setVolume(volume); }
public void SFXVolume(float val) { vca_sfx.setVolume(val); PlayerPrefs.SetFloat("SFXVolume", val); }
public void SetSxVolume(float volume) { sxVca.setVolume(volume); }
// Start is called before the first frame update void Start() { vca_mus = FMODUnity.RuntimeManager.GetVCA("vca:/Music"); vca_sfx = FMODUnity.RuntimeManager.GetVCA("vca:/SFX"); //Load volume settings if (PlayerPrefs.HasKey("MusicVolume")) { vca_mus.setVolume(PlayerPrefs.GetFloat("MusicVolume")); } else { vca_mus.setVolume(1.0f); } if (PlayerPrefs.HasKey("SFXVolume")) { vca_sfx.setVolume(PlayerPrefs.GetFloat("SFXVolume")); } else { vca_sfx.setVolume(1.0f); } //Load Mouse settings if (PlayerPrefs.HasKey("MouseAcceleration")) { PlayerCameraController.SetMouseAccel(PlayerPrefs.GetInt("MouseAcceleration") == 1); } if (PlayerPrefs.HasKey("MouseSensitivity")) { PlayerCameraController.SetMouseSens(PlayerPrefs.GetFloat("MouseSensitivity")); } GameObject pausePanelObj = GameObject.Find("PauseMenu"); if (pausePanelObj != null) { pausePanel = pausePanelObj.GetComponent <CanvasGroup>(); } GameObject hudObj = GameObject.Find("HUD"); if (hudObj != null) { hud = hudObj.GetComponent <CanvasGroup>(); } pauseOpen = false; curMenu = hud; if (!isMainMenu) { Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; } else { Cursor.visible = true; Cursor.lockState = CursorLockMode.None; } }
private void SetVcaVolumes() { musicVCA.setVolume(dBtoLinear(musicVolume)); sfxVCA.setVolume(dBtoLinear(sfxVolume)); }