r2mods/ilspy_dump/ror2_csproj/RoR2/SyncFlickerLightToAnimateSh...

36 lines
754 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
namespace RoR2;
public class SyncFlickerLightToAnimateShaderAlpha : MonoBehaviour
{
[SerializeField]
private AnimateShaderAlpha animateShaderAlpha;
[SerializeField]
private FlickerLight flickerLight;
private float startingIntensity = 1f;
private AnimationCurve acCurve;
private void Start()
{
startingIntensity = animateShaderAlpha.alphaCurve.Evaluate(0f);
}
private void OnEnable()
{
flickerLight.UpdateLightIntensityMultiplier(startingIntensity);
acCurve = animateShaderAlpha.alphaCurve;
}
private void Update()
{
if (animateShaderAlpha.enabled && flickerLight.enabled)
{
flickerLight.UpdateLightIntensityMultiplier(acCurve.Evaluate(animateShaderAlpha.time / animateShaderAlpha.timeMax));
}
}
}