summaryrefslogtreecommitdiff
path: root/Thronefall_1_0/Decompile/NightLight.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-05-20 22:36:58 +0800
committerchai <215380520@qq.com>2024-05-20 22:36:58 +0800
commita22c505984697881f5f911a165ee022087b69e09 (patch)
treed3c030aef1ae9b8a01c889dd2902bb1e3324e72b /Thronefall_1_0/Decompile/NightLight.cs
parent4a4cc82d069b26bc4d4532e73860f86b211ca239 (diff)
*renameHEADmaster
Diffstat (limited to 'Thronefall_1_0/Decompile/NightLight.cs')
-rw-r--r--Thronefall_1_0/Decompile/NightLight.cs98
1 files changed, 0 insertions, 98 deletions
diff --git a/Thronefall_1_0/Decompile/NightLight.cs b/Thronefall_1_0/Decompile/NightLight.cs
deleted file mode 100644
index affc9b0..0000000
--- a/Thronefall_1_0/Decompile/NightLight.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using System.Collections;
-using UnityEngine;
-
-[RequireComponent(typeof(Light))]
-public class NightLight : MonoBehaviour, DayNightCycle.IDaytimeSensitive
-{
- public float targetIntensity = 0.75f;
-
- public float intensityFlickerRange = 0.15f;
-
- public float distanceFlickerRange = 5f;
-
- public float flickerSpeed = 1f;
-
- public float fadeInTime = 2.5f;
-
- public float fadeOutTime = 1f;
-
- public ParticleSystem flames;
-
- private float transitionTime;
-
- private float targetRange;
-
- private Light targetLight;
-
- private bool fullyFadedIn;
-
- private float currentIntensity => targetIntensity + Mathf.Lerp(0f - intensityFlickerRange, intensityFlickerRange, Mathf.PerlinNoise(Time.time * flickerSpeed, Time.time * flickerSpeed));
-
- private float currentRange => targetRange + Mathf.Lerp(0f - distanceFlickerRange, distanceFlickerRange, Mathf.PerlinNoise(Time.time * flickerSpeed, Time.time * flickerSpeed));
-
- private void Start()
- {
- transitionTime = DayNightCycle.Instance.sunriseTime;
- DayNightCycle.Instance.RegisterDaytimeSensitiveObject(this);
- targetLight = GetComponent<Light>();
- targetLight.intensity = 0f;
- targetRange = targetLight.range;
- base.gameObject.SetActive(value: false);
- }
-
- private void Update()
- {
- if (fullyFadedIn)
- {
- targetLight.intensity = currentIntensity;
- }
- targetLight.range = currentRange;
- }
-
- public void OnDawn_AfterSunrise()
- {
- }
-
- public void OnDawn_BeforeSunrise()
- {
- StopAllCoroutines();
- StartCoroutine(FadeLightOut());
- }
-
- public void OnDusk()
- {
- base.gameObject.SetActive(value: true);
- StopAllCoroutines();
- StartCoroutine(FadeLightIn());
- }
-
- private IEnumerator FadeLightIn()
- {
- fullyFadedIn = false;
- float clock = 0f;
- yield return new WaitForSeconds(transitionTime * 0.1f);
- flames.Play();
- while (clock < fadeInTime)
- {
- clock += Time.deltaTime;
- targetLight.intensity = currentIntensity * Mathf.InverseLerp(0f, fadeInTime, clock);
- yield return null;
- }
- targetLight.intensity = targetIntensity;
- fullyFadedIn = true;
- }
-
- private IEnumerator FadeLightOut()
- {
- float clock = 0f;
- flames.Stop();
- while (clock < fadeOutTime)
- {
- clock += Time.deltaTime;
- targetLight.intensity = currentIntensity * Mathf.InverseLerp(fadeOutTime, 0f, clock);
- yield return null;
- }
- targetLight.intensity = 0f;
- base.gameObject.SetActive(value: false);
- }
-}