2025-06-03 02:42:28 -04:00
|
|
|
using Ichni.RhythmGame.Beatmap;
|
|
|
|
|
using UnityEngine;
|
2026-03-14 03:13:10 -04:00
|
|
|
using UnityEngine.Rendering.Universal;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
|
|
|
|
namespace Ichni.RhythmGame
|
|
|
|
|
{
|
|
|
|
|
public class BloomEffect : EffectBase
|
|
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
#region [效果参数] Effect Parameters
|
2025-06-03 02:42:28 -04:00
|
|
|
public float peak;
|
|
|
|
|
public AnimationCurve intensityCurve;
|
|
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
private Bloom _bloom;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region [初始化] Initialization
|
2026-03-31 07:51:40 -04:00
|
|
|
public BloomEffect(float effectTime, float peak, AnimationCurve intensityCurve)
|
|
|
|
|
: base(effectTime) // 激活时间线
|
2025-06-03 02:42:28 -04:00
|
|
|
{
|
2026-03-31 07:51:40 -04:00
|
|
|
this.effectTime = effectTime;
|
2025-06-03 02:42:28 -04:00
|
|
|
this.peak = peak;
|
|
|
|
|
this.intensityCurve = intensityCurve;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
private void PrepareEffectHandle()
|
2025-06-03 02:42:28 -04:00
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
if (_bloom == null && PostProcessingManager.GlobalVolume != null)
|
|
|
|
|
{
|
|
|
|
|
PostProcessingManager.GlobalVolume.profile.TryGet(out _bloom);
|
|
|
|
|
}
|
2025-06-03 02:42:28 -04:00
|
|
|
}
|
2026-03-14 03:13:10 -04:00
|
|
|
#endregion
|
2025-06-03 02:42:28 -04:00
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
#region [效果逻辑覆盖] Effect Pattern Overrides
|
|
|
|
|
public override void PreExecute()
|
2025-06-03 02:42:28 -04:00
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
PrepareEffectHandle();
|
2025-06-03 02:42:28 -04:00
|
|
|
}
|
|
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
public override void Execute()
|
2025-06-03 02:42:28 -04:00
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
if (_bloom != null)
|
2025-06-03 02:42:28 -04:00
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
float currentIntensity = intensityCurve.Evaluate(effectProgressPercent) * peak;
|
|
|
|
|
_bloom.intensity.value = currentIntensity;
|
2025-06-03 02:42:28 -04:00
|
|
|
}
|
|
|
|
|
}
|
2026-03-14 03:13:10 -04:00
|
|
|
|
|
|
|
|
public override void Adjust() { ResetEffect(); }
|
|
|
|
|
public override void Recover() { ResetEffect(); }
|
|
|
|
|
public override void Disrupt() { ResetEffect(); }
|
|
|
|
|
|
|
|
|
|
private void ResetEffect()
|
|
|
|
|
{
|
|
|
|
|
if (_bloom != null) _bloom.intensity.value = 0f;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2025-06-03 02:42:28 -04:00
|
|
|
}
|
2026-03-14 03:13:10 -04:00
|
|
|
|
|
|
|
|
}
|
2026-03-31 07:51:40 -04:00
|
|
|
|
|
|
|
|
|