Exemple #1
0
        private void CalculateValue()
        {
            if (!Application.isPlaying)
            {
                return;
            }

            if (sliderType == AC_SliderType.Speech || sliderType == AC_SliderType.SFX || sliderType == AC_SliderType.Music)
            {
                if (Options.optionsData != null)
                {
                    if (sliderType == AC_SliderType.Speech)
                    {
                        amount = Options.optionsData.speechVolume;
                    }
                    else if (sliderType == AC_SliderType.Music)
                    {
                        amount = Options.optionsData.musicVolume;
                    }
                    else if (sliderType == AC_SliderType.SFX)
                    {
                        amount = Options.optionsData.sfxVolume;
                    }
                }
            }
            else if (sliderType == AC_SliderType.FloatVariable)
            {
                if (varID >= 0)
                {
                    GVar _variable = RuntimeVariables.GetVariable(varID);
                    if (_variable != null)
                    {
                        if (_variable.type != VariableType.Float)
                        {
                            Debug.LogWarning("Cannot link MenuSlider " + title + " to Variable " + varID + " as it is not a Float.");
                        }
                        else
                        {
                            amount = Mathf.Clamp(RuntimeVariables.GetFloatValue(varID), 0f, 1f);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Slider " + this.label + " is referencing Gloval Variable " + varID + ", which does not exist.");
                    }
                }
            }
        }