Files
2026-02-21 16:45:37 +08:00

34 lines
718 B
C#

using UnityEngine;
public class ColorDayTime : MonoBehaviour
{
public Gradient timeColor = new Gradient();
public Gradient timeColorWinter = new Gradient();
private Material material;
private WeatherLevelManager weatherLevelManager;
private bool isIceLevel;
private void Start()
{
material = GetComponent<MeshRenderer>().sharedMaterial;
weatherLevelManager = GameController.Instance.weatherLevelManager;
isIceLevel = GameController.Instance.iceLevel;
}
private void LateUpdate()
{
if (isIceLevel)
{
material.color = timeColorWinter.Evaluate(weatherLevelManager.GetFullTime() / 24f);
}
else
{
material.color = timeColor.Evaluate(weatherLevelManager.GetFullTime() / 24f);
}
}
}