57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
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)]
|
||
public float speed = 10f;
|
||
|
||
protected override void TriggerEvent(FeedbackContext context)
|
||
{
|
||
FloatCurveChannel finalSpeedCurve = modifySpeed
|
||
? speedCurve
|
||
: new FloatCurveChannel(AnimationCurve.Constant(0, 1, 1), 0, speed, false);
|
||
|
||
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;
|
||
}
|
||
}
|
||
}
|