Files
Cielonos/Assets/Scripts/MainGame/Effects/Feedbacks/Actions/Postprocessing/RGBSplitGlitchAction.cs

57 lines
1.7 KiB
C#
Raw Normal View History

2026-04-28 15:46:32 -04:00
using System;
using Sirenix.OdinInspector;
using SLSUtilities.Feedback;
using UnityEngine;
namespace Cielonos.MainGame.Effects.Feedback
{
/// <summary>
/// RGB分离故障反馈动作通过 RGBSplitGlitchShakeEvent 触发 RGBSplitGlitchShaker。
/// </summary>
[Serializable]
[FeedbackActionColor(1f, 0.3f, 0.8f)]
public class RGBSplitGlitchAction : PostprocessingActionBase
{
public override string DisplayName => "RGB Split Glitch";
[LabelText("强度曲线")]
public FloatCurveChannel intensityCurve = FloatCurveChannel.CreateDefault(remapMax: 1f);
[LabelText("修改速度")]
public bool modifySpeed;
[ShowIf("modifySpeed")]
[LabelText("速度曲线")]
public FloatCurveChannel speedCurve = FloatCurveChannel.CreateDefault(remapMax: 50f);
[HideIf("modifySpeed")]
[LabelText("速度")]
[Range(0f, 100f)]
2026-04-30 07:06:38 -04:00
public float speed = 10f;
2026-04-28 15:46:32 -04:00
protected override void TriggerEvent(FeedbackContext context)
{
2026-04-30 07:06:38 -04:00
FloatCurveChannel finalSpeedCurve = modifySpeed
? speedCurve
: new FloatCurveChannel(AnimationCurve.Constant(0, 1, 1), 0, speed, false);
2026-04-28 15:46:32 -04:00
RGBSplitGlitchShakeEvent.Trigger(
context,
intensityCurve,
finalSpeedCurve
);
}
protected override void StopEvent(FeedbackContext context)
{
RGBSplitGlitchShakeEvent.Trigger(context, intensityCurve, stop: true);
}
public override bool Validate(out string error)
{
error = null;
return true;
}
}
}