Example #1
0
    void Start()
    {
        // TODO 移動開始してから音鳴らしたほうがいいかも
        bgm1.Play();

        GameEventManager.Instance.OnEnterLastArea += () =>
        {
            // TODO 綺麗につなぐ
            StartCoroutine(bgm1.Fade(0, 0.5f));
            fill.Play();
            Invoke("PlayBgm2", fill.clip.length - 0.05f);
        };

        GameEventManager.Instance.OnEnterGoalLine += () =>
        {
            //TODO フェードアウトとかしたほうが良さそう
            fill.Stop();
            StartCoroutine(bgm2.Fade(0, 1.0f));
        };

        GameEventManager.Instance.OnPlayerDead += () =>
        {
            StartCoroutine(bgm1.Fade(0, 0.1f));
            StartCoroutine(fill.Fade(0, 0.1f));
            StartCoroutine(bgm2.Fade(0, 0.1f));
        };
    }
Example #2
0
    /// <summary>
    /// Fade out and stop the background music
    /// </summary>
    public void StopBackroundMusic()
    {
        float fadeSeconds = 1;

        BackgroundMusicSource.Fade(this, BackgroundMusicSource.volume, 0, fadeSeconds, true);
        this.Delay(fadeSeconds, () =>
        {
            BackgroundMusicSource.Stop();
        });
    }
Example #3
0
 /// <summary>
 /// Begin Fade In Audio
 /// </summary>
 private void FadeInAudio()
 {
     if (FadeInAudioSeconds > 0)
     {
         audioSource.Fade(this, 0, 1, FadeInAudioSeconds, true);
     }
     else
     {
         this.audioSource.volume = 1;
     }
 }