Esempio n. 1
0
    public void SetLevel(float sliderValue)
    {
        var mixerVolume = VolumeCalculation.GetVolumeDecibels(sliderValue, reductionDb);

        Debug.Log($"Audio - Slider - Set Audio Level for {valueName} to {sliderValue} ({mixerVolume}db)", this);
        mixer.SetFloat(valueName, mixerVolume);
        PlayerPrefs.SetFloat(valueName, sliderValue);
        Message.Publish(new MixerVolumeChanged(valueName));
    }
    private void Start()
    {
        var volume      = PlayerPrefs.GetFloat(valueName, 0.5f);
        var mixerVolume = VolumeCalculation.GetVolumeDecibels(volume, reductionDb);

        Debug.Log($"Audio - Init - Set Audio Level for {valueName} to {volume} ({mixerVolume}db)", gameObject);
        mixer.SetFloat(valueName, mixerVolume);
        if (player != null && demoSound != null)
        {
            player.PlayOneShot(demoSound, 1f);
        }
    }
Esempio n. 3
0
    public void PlaySelectedMusicLooping(IntroloopAudio clipToPlay)
    {
        if (currentClip != null && currentClip.name == clipToPlay.name)
        {
            return;
        }

        currentClip = clipToPlay;
        var volume = PlayerPrefs.GetFloat(volumeValueName, 0.75f);

        mixer.SetFloat(volumeValueName, VolumeCalculation.GetVolumeDecibels(volume, reductionDb));
        IntroloopPlayer.Instance.Play(clipToPlay);
    }
 /// <summary>
 /// ToString: is meant to display specifically formated
 /// </summary>
 /// <returns>return formated string</returns>
 public override string ToString()
 {
     return(string.Format("{0,-11}\t{1,10}\t{2,10}\t{3,-45}",
                          this.GetType().Name, AreaCalculation.ToString("0.00"), VolumeCalculation.ToString("0.00"), $"{base.Radius.ToString("0.00")} r x {base.Height.ToString("0.00")} h"));
 }