Files
SoulliesOfficial 25b6da25ae 同步
2026-03-31 07:51:40 -04:00

74 lines
2.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace Ichni.RhythmGame
{
public class VignetteEffect : EffectBase
{
#region [] Effect Parameters
public float peak;
public float smoothness;
public Color color;
public AnimationCurve intensityCurve;
private Vignette _vignette;
#endregion
#region [] Initialization
public VignetteEffect(float effectTime, float peak, float smoothness, Color color, AnimationCurve intensityCurve)
: base(effectTime)
{
this.effectTime = effectTime;
this.peak = peak;
this.smoothness = smoothness;
this.color = color;
this.intensityCurve = intensityCurve;
}
private void PrepareEffectHandle()
{
if (_vignette == null && PostProcessingManager.GlobalVolume != null)
{
PostProcessingManager.GlobalVolume.profile.TryGet(out _vignette);
}
}
#endregion
#region [] Effect Pattern Overrides
public override void PreExecute()
{
PrepareEffectHandle();
if (_vignette != null)
{
_vignette.smoothness.value = smoothness;
_vignette.color.value = color;
}
}
public override void Execute()
{
if (_vignette != null)
{
float currentIntensity = intensityCurve.Evaluate(effectProgressPercent) * peak;
_vignette.intensity.value = currentIntensity;
}
}
// 注意暗角和其它的不同它的默认值通常不是0而是类似0.2左右
public override void Adjust() { ResetEffect(); }
public override void Recover() { ResetEffect(); }
public override void Disrupt() { ResetEffect(); }
private void ResetEffect()
{
if (_vignette != null) _vignette.intensity.value = 0f; // 你可以修改为符合你游戏默认画风的默认暗角值
}
#endregion
}
}