您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
26 行
765 B
26 行
765 B
using UnityEngine;
|
|
using UnityEngine.Experimental.Rendering.HDPipeline;
|
|
|
|
[RequireComponent(typeof(Light))]
|
|
public class LightAnimationManager : MonoBehaviour
|
|
{
|
|
private float initialIntensity;
|
|
private HDAdditionalLightData lightData;
|
|
|
|
void Start()
|
|
{
|
|
lightData = gameObject.GetComponent<HDAdditionalLightData>();
|
|
initialIntensity = lightData.lightDimmer;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
var currentValue = 1.0f;
|
|
foreach (var lightAnimator in gameObject.GetComponents<AbstractLightAnimation>())
|
|
{
|
|
currentValue *= lightAnimator.getCurrentValue();
|
|
}
|
|
lightData.lightDimmer = currentValue * initialIntensity;
|
|
lightData.volumetricDimmer = currentValue * initialIntensity;
|
|
}
|
|
}
|