/** * <summary>Sets the value of the 'SFX volume'.</summary> * <param name = "newVolume">The new value of the 'SFX volume'</param> */ public static void SetSFXVolume(float newVolume) { KickStarter.options.SetVolume(SoundType.SFX, newVolume); AdvGame.SetMixerVolume(KickStarter.settingsManager.sfxMixerGroup, KickStarter.settingsManager.sfxAttentuationParameter, newVolume); }
private void UpdateValue() { if (uiSlider == null) { if (amount < 0f) { amount = 0; } else if (amount > 1f) { amount = 1f; } // Limit by steps if (numberOfSteps > 0) { float valueSeparation = 1f / (float)numberOfSteps; float nearestValue = 0f; while (nearestValue < amount) { nearestValue += valueSeparation; } // Now larger than amount, so which is closer? float lowerNearest = nearestValue - valueSeparation; if (amount - lowerNearest > nearestValue - amount) { amount = nearestValue; } else { amount = lowerNearest; } } } if (sliderType == AC_SliderType.Speech || sliderType == AC_SliderType.SFX || sliderType == AC_SliderType.Music) { if (Options.optionsData != null) { if (sliderType == AC_SliderType.Speech) { Options.optionsData.speechVolume = amount; } else if (sliderType == AC_SliderType.Music) { Options.optionsData.musicVolume = amount; KickStarter.options.SetVolume(SoundType.Music); } else if (sliderType == AC_SliderType.SFX) { Options.optionsData.sfxVolume = amount; KickStarter.options.SetVolume(SoundType.SFX); } #if UNITY_5 if (sliderType == AC_SliderType.Speech) { AdvGame.SetMixerVolume(KickStarter.settingsManager.speechMixerGroup, KickStarter.settingsManager.speechAttentuationParameter, amount); } else if (sliderType == AC_SliderType.Music) { AdvGame.SetMixerVolume(KickStarter.settingsManager.musicMixerGroup, KickStarter.settingsManager.musicAttentuationParameter, amount); } else if (sliderType == AC_SliderType.SFX) { AdvGame.SetMixerVolume(KickStarter.settingsManager.sfxMixerGroup, KickStarter.settingsManager.sfxAttentuationParameter, amount); } #endif Options.SavePrefs(); } else { Debug.LogWarning("Could not find Options data!"); } } else if (sliderType == AC_SliderType.FloatVariable) { if (varID >= 0) { GVar var = RuntimeVariables.GetVariable(varID); if (var.type == VariableType.Float) { var.floatVal = amount; var.Upload(); } } } }
private void UpdateValue() { if (uiSlider == null) { visualAmount = Mathf.Clamp(visualAmount, 0f, 1f); // Limit by steps if (numberOfSteps > 0) { visualAmount = Mathf.Round(visualAmount * numberOfSteps) / numberOfSteps; } amount = (visualAmount * (maxValue - minValue)) + minValue; } else { amount = visualAmount; } if (sliderType == AC_SliderType.Speech || sliderType == AC_SliderType.SFX || sliderType == AC_SliderType.Music) { if (Options.optionsData != null) { if (sliderType == AC_SliderType.Speech) { KickStarter.options.SetVolume(SoundType.Speech, amount); } else if (sliderType == AC_SliderType.Music) { KickStarter.options.SetVolume(SoundType.Music, amount); } else if (sliderType == AC_SliderType.SFX) { KickStarter.options.SetVolume(SoundType.SFX, amount); } #if UNITY_5 || UNITY_2017_1_OR_NEWER if (sliderType == AC_SliderType.Speech) { AdvGame.SetMixerVolume(KickStarter.settingsManager.speechMixerGroup, KickStarter.settingsManager.speechAttentuationParameter, amount); } else if (sliderType == AC_SliderType.Music) { AdvGame.SetMixerVolume(KickStarter.settingsManager.musicMixerGroup, KickStarter.settingsManager.musicAttentuationParameter, amount); } else if (sliderType == AC_SliderType.SFX) { AdvGame.SetMixerVolume(KickStarter.settingsManager.sfxMixerGroup, KickStarter.settingsManager.sfxAttentuationParameter, amount); } #endif } else { ACDebug.LogWarning("Could not find Options data!"); } } else if (sliderType == AC_SliderType.FloatVariable) { if (varID >= 0) { GlobalVariables.SetFloatValue(varID, amount); } } if (!KickStarter.actionListAssetManager.IsListRunning(actionListOnChange)) { AdvGame.RunActionListAsset(actionListOnChange); } }
private void UpdateValue() { if (uiSlider == null) { visualAmount = Mathf.Clamp(visualAmount, 0f, 1f); // Limit by steps if (numberOfSteps > 0) { float valueSeparation = 1f / (float)numberOfSteps; float nearestValue = 0f; while (nearestValue < visualAmount) { nearestValue += valueSeparation; } // Now larger than amount, so which is closer? float lowerNearest = nearestValue - valueSeparation; if (visualAmount - lowerNearest > nearestValue - amount) { visualAmount = nearestValue; } else { visualAmount = lowerNearest; } } amount = (visualAmount * (maxValue - minValue)) + minValue; } else { amount = visualAmount; } if (sliderType == AC_SliderType.Speech || sliderType == AC_SliderType.SFX || sliderType == AC_SliderType.Music) { if (Options.optionsData != null) { if (sliderType == AC_SliderType.Speech) { Options.optionsData.speechVolume = amount; KickStarter.options.SetVolume(SoundType.SFX); } else if (sliderType == AC_SliderType.Music) { Options.optionsData.musicVolume = amount; KickStarter.options.SetVolume(SoundType.Music); } else if (sliderType == AC_SliderType.SFX) { Options.optionsData.sfxVolume = amount; KickStarter.options.SetVolume(SoundType.SFX); } #if UNITY_5 if (sliderType == AC_SliderType.Speech) { AdvGame.SetMixerVolume(KickStarter.settingsManager.speechMixerGroup, KickStarter.settingsManager.speechAttentuationParameter, amount); } else if (sliderType == AC_SliderType.Music) { AdvGame.SetMixerVolume(KickStarter.settingsManager.musicMixerGroup, KickStarter.settingsManager.musicAttentuationParameter, amount); } else if (sliderType == AC_SliderType.SFX) { AdvGame.SetMixerVolume(KickStarter.settingsManager.sfxMixerGroup, KickStarter.settingsManager.sfxAttentuationParameter, amount); } #endif Options.SavePrefs(); } else { ACDebug.LogWarning("Could not find Options data!"); } } else if (sliderType == AC_SliderType.FloatVariable) { if (varID >= 0) { GVar var = GlobalVariables.GetVariable(varID); if (var.type == VariableType.Float) { var.SetFloatValue(amount); } } } if (!KickStarter.actionListManager.IsListRunning(actionListOnChange)) { AdvGame.RunActionListAsset(actionListOnChange); } }