您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
41 行
1.1 KiB
41 行
1.1 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.HighDefinition;
|
|
using UnityEngine.VFX;
|
|
using UnityEngine.VFX.Utility;
|
|
|
|
|
|
[ExecuteAlways]
|
|
[RequireComponent(typeof(HDAdditionalLightData))]
|
|
|
|
public class OutputEventHandlerLightUpdate : VFXOutputEventPrefabAttributeAbstractHandler
|
|
{
|
|
public AnimationCurve brightnessScaleOverTime;
|
|
public AnimationCurve volumetricScaleOverTime;
|
|
public Gradient colorOverTime;
|
|
|
|
float time;
|
|
HDAdditionalLightData additionalLightData;
|
|
|
|
private void OnEnable()
|
|
{
|
|
additionalLightData = GetComponent<HDAdditionalLightData>();
|
|
|
|
}
|
|
|
|
public override void OnVFXEventAttribute(VFXEventAttribute eventAttribute, VisualEffect visualEffect)
|
|
{
|
|
time = 0;
|
|
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
time += Time.deltaTime;
|
|
additionalLightData.lightDimmer = brightnessScaleOverTime.Evaluate(time);
|
|
additionalLightData.volumetricDimmer = volumetricScaleOverTime.Evaluate(time);
|
|
additionalLightData.color = colorOverTime.Evaluate(time);
|
|
|
|
}
|
|
}
|