Beispiel #1
0
    private float maxVolume = 1.0f;                              //最大音量


    private void Update()
    {
        foreach (GameObject buffer in buffers)
        {
            if (!buffer)                                                //削除された場合
            {
                continue;
            }

            SoundBuffer sound = buffer.GetComponent <SoundBuffer>();
            if (sound.CurrentState() != FadeState.None)
            {
                sound.UpdateFade();
            }
        }

        buffers.RemoveAll(g => g == null);
    }
Beispiel #2
0
    /// <summary>
    /// 全体のBGM音量を設定
    /// </summary>
    public void SetMaxVolume(float maxVolume)
    {
        this.maxVolume = maxVolume;
        foreach (GameObject buffer in buffers)
        {
            SoundBuffer sound = buffer.GetComponent <SoundBuffer>();
            if (sound.CurrentState() == FadeState.FadeOut)         //FadeOut処理はそのまま
            {
                continue;
            }

            sound.SetMaxVolume(maxVolume);                          //最大音量設定
            if (maxVolume == 1.0f)
            {
                sound.SetState(FadeState.FadeIn);                  //最大の場合はFadeInを使う
                continue;
            }
            sound.SetState(FadeState.LerpToMax);
        }
    }