2024-01-03 06:34:33 +00:00
|
|
|
using System.Collections;
|
|
|
|
using DistantLands.Cozy.Data;
|
2023-09-13 05:07:40 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
2024-01-03 06:34:33 +00:00
|
|
|
namespace DistantLands.Cozy
|
|
|
|
{
|
2023-09-13 05:07:40 +00:00
|
|
|
public class CozyUtilities
|
|
|
|
{
|
|
|
|
|
|
|
|
public Color DoubleGradient(Gradient start, Gradient target, float depth, float time)
|
|
|
|
{
|
|
|
|
return Color.Lerp(start.Evaluate(time), target.Evaluate(time), depth);
|
|
|
|
}
|
|
|
|
|
2024-01-03 06:34:33 +00:00
|
|
|
|
|
|
|
|
2023-09-13 05:07:40 +00:00
|
|
|
}
|
2024-01-03 06:34:33 +00:00
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
public class WeatherRelation
|
|
|
|
{
|
|
|
|
[Range(0, 1)] public float weight; public WeatherProfile profile; public bool transitioning = true;
|
|
|
|
|
|
|
|
public IEnumerator Transition(float value, float time)
|
|
|
|
{
|
|
|
|
|
|
|
|
transitioning = true;
|
|
|
|
float t = 0;
|
|
|
|
float start = weight;
|
|
|
|
|
|
|
|
while (t < time)
|
|
|
|
{
|
|
|
|
|
|
|
|
float div = (t / time);
|
|
|
|
yield return new WaitForEndOfFrame();
|
|
|
|
|
|
|
|
weight = Mathf.Lerp(start, value, div);
|
|
|
|
t += Time.deltaTime;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
weight = value;
|
|
|
|
transitioning = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-13 05:07:40 +00:00
|
|
|
}
|