46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
using BitStrap;
|
|
using UnityEngine;
|
|
|
|
public class ParameterPerHour : MonoBehaviour
|
|
{
|
|
public AnimationCurve curve = AnimationCurve.EaseInOut(0f, 0f, 24f, 1f);
|
|
|
|
public AnimationCurve heightCurve = AnimationCurve.EaseInOut(0f, 1f, 5f, 0f);
|
|
|
|
public bool updateEmission;
|
|
|
|
[ReadOnly]
|
|
public Material material;
|
|
|
|
[ReadOnly]
|
|
public GameController gameController;
|
|
|
|
[ReadOnly]
|
|
public WeatherLevelManager weatherLevelManager;
|
|
|
|
private void Start()
|
|
{
|
|
gameController = GameController.Instance;
|
|
if ((bool)gameController)
|
|
{
|
|
weatherLevelManager = gameController.weatherLevelManager;
|
|
}
|
|
if ((bool)GetComponent<MeshRenderer>())
|
|
{
|
|
material = GetComponent<MeshRenderer>().material;
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if ((bool)gameController && weatherLevelManager == null)
|
|
{
|
|
weatherLevelManager = gameController.weatherLevelManager;
|
|
}
|
|
if ((bool)gameController && updateEmission)
|
|
{
|
|
material.SetFloat("_DetailEmissiveness", curve.Evaluate(weatherLevelManager.GetHour()) * heightCurve.Evaluate(gameController.fishingPlayer.transform.position.y));
|
|
}
|
|
}
|
|
}
|