Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using DG.Tweening;
- using DG.Tweening.Core;
- using DG.Tweening.Plugins.Options;
- using UnityEngine;
- using UnityEngine.Rendering.HighDefinition;
- public static class ExtraDOTweenShortcuts
- {
- /// <summary>Tweens a Light's shadowStrength to the given value.
- /// Also stores the light as the tween's target so it can be used for filtered operations.<para/>
- /// Note that this method contains an internal GetComponent call to retrieve
- /// the <see cref="HDAdditionalLightData"/> necessary to tween the shadow dimmer.
- /// To avoid the GetComponent call use the overload that accepts a <see cref="HDAdditionalLightData"/> target.</summary>
- /// <param name="endValue">The end value to reach</param>
- /// <param name="duration">The duration of the tween</param>
- public static TweenerCore<float, float, FloatOptions> DOHDRPShadowDimmer(this Light target, float endValue, float duration)
- {
- HDAdditionalLightData lightData = target.GetComponent<HDAdditionalLightData>();
- TweenerCore<float, float, FloatOptions> t = DOTween.To(() => lightData.shadowDimmer, x => lightData.shadowDimmer = x, endValue, duration);
- t.SetTarget(target);
- return t;
- }
- /// <summary>Tweens a Light's shadowStrength to the given value.
- /// Also stores the light as the tween's target so it can be used for filtered operations</summary>
- /// <param name="endValue">The end value to reach</param>
- /// <param name="duration">The duration of the tween</param>
- public static TweenerCore<float, float, FloatOptions> DOHDRPShadowDimmer(this HDAdditionalLightData target, float endValue, float duration)
- {
- TweenerCore<float, float, FloatOptions> t = DOTween.To(() => target.shadowDimmer, x => target.shadowDimmer = x, endValue, duration);
- t.SetTarget(target);
- return t;
- }
- }
Add Comment
Please, Sign In to add comment