From a22c505984697881f5f911a165ee022087b69e09 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Mon, 20 May 2024 22:36:58 +0800 Subject: *rename --- Thronefall_1_0/Decompile/AudioDayNightFader.cs | 87 -------------------------- 1 file changed, 87 deletions(-) delete mode 100644 Thronefall_1_0/Decompile/AudioDayNightFader.cs (limited to 'Thronefall_1_0/Decompile/AudioDayNightFader.cs') diff --git a/Thronefall_1_0/Decompile/AudioDayNightFader.cs b/Thronefall_1_0/Decompile/AudioDayNightFader.cs deleted file mode 100644 index 7734d83..0000000 --- a/Thronefall_1_0/Decompile/AudioDayNightFader.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System.Collections; -using UnityEngine; -using UnityEngine.Audio; - -public class AudioDayNightFader : MonoBehaviour, DayNightCycle.IDaytimeSensitive -{ - public float fadeTime = 0.5f; - - public AudioMixer mixer; - - public AudioClip nightMusic; - - public AudioClip finalNightMusic; - - public float nightMusicFadeInTime = 3f; - - public float nightMusicFadeOutTime = 4f; - - private float transitionClock; - - private float dayTargetVol; - - private float nightTargetVol; - - private void Start() - { - DayNightCycle.Instance.RegisterDaytimeSensitiveObject(this); - mixer.GetFloat("DayEnvVolume", out dayTargetVol); - mixer.GetFloat("NightEnvVolume", out nightTargetVol); - dayTargetVol = Mathf.Pow(10f, dayTargetVol / 20f); - nightTargetVol = Mathf.Pow(10f, nightTargetVol / 20f); - mixer.SetFloat("NightEnvVolume", Mathf.Log10(0.0001f) * 20f); - } - - public void OnDawn_AfterSunrise() - { - } - - public void OnDawn_BeforeSunrise() - { - StopAllCoroutines(); - StartCoroutine(FadeToDay()); - } - - public void OnDusk() - { - StopAllCoroutines(); - StartCoroutine(FadeToNight()); - } - - private IEnumerator FadeToNight() - { - if (EnemySpawner.instance.Wavenumber >= EnemySpawner.instance.waves.Count - 1) - { - MusicManager.instance.PlayMusic(finalNightMusic, nightMusicFadeInTime); - } - else - { - MusicManager.instance.PlayMusic(nightMusic, nightMusicFadeInTime); - } - while (transitionClock < 1f) - { - transitionClock += Time.deltaTime / fadeTime; - mixer.SetFloat("DayEnvVolume", Mathf.Log10(Mathf.Lerp(dayTargetVol, 0.0001f, transitionClock)) * 20f); - mixer.SetFloat("NightEnvVolume", Mathf.Log10(Mathf.Lerp(0.0001f, nightTargetVol, transitionClock)) * 20f); - yield return null; - } - transitionClock = 1f; - mixer.SetFloat("DayEnvVolume", Mathf.Log10(0.0001f) * 20f); - mixer.SetFloat("NightEnvVolume", Mathf.Log10(nightTargetVol) * 20f); - } - - private IEnumerator FadeToDay() - { - MusicManager.instance.PlayMusic(null, nightMusicFadeOutTime); - while (transitionClock > 0f) - { - transitionClock -= Time.deltaTime / fadeTime; - mixer.SetFloat("DayEnvVolume", Mathf.Log10(Mathf.Lerp(dayTargetVol, 0.0001f, transitionClock)) * 20f); - mixer.SetFloat("NightEnvVolume", Mathf.Log10(Mathf.Lerp(0.0001f, nightTargetVol, transitionClock)) * 20f); - yield return null; - } - transitionClock = 0f; - mixer.SetFloat("DayEnvVolume", Mathf.Log10(dayTargetVol) * 20f); - mixer.SetFloat("NightEnvVolume", Mathf.Log10(0.0001f) * 20f); - } -} -- cgit v1.1-26-g67d0