Files
Cielonos/Assets/Scripts/MainGame/Effects/Feedbacks/Actions/Postprocessing/StrobeFlashAction.cs
2026-04-18 13:57:19 -04:00

60 lines
1.7 KiB
C#

using System;
using Sirenix.OdinInspector;
using SLSUtilities.Feedback;
using UnityEngine;
namespace Cielonos.MainGame.Effects.Feedback
{
/// <summary>
/// 黑白闪反馈动作,通过 StrobeFlashShakeEvent 触发 StrobeFlashShaker。
/// </summary>
[Serializable]
[FeedbackActionColor(1.0f, 0.9f, 0.3f)]
public class StrobeFlashAction : PostprocessingActionBase
{
public override string DisplayName => "Strobe Flash";
/// <summary>
/// 是否修改频率和颜色参数。
/// </summary>
[TitleGroup("闪烁设置")]
[LabelText("修改额外参数")]
public bool modifyExtra;
[ShowIf("modifyExtra")]
[LabelText("频率曲线")]
public FloatCurveChannel frequencyCurve = FloatCurveChannel.CreateDefault(remapMax: 15f);
[ShowIf("modifyExtra")]
[LabelText("高颜色")]
public ColorCurveChannel colorHigh = ColorCurveChannel.CreateDefault();
[ShowIf("modifyExtra")]
[LabelText("低颜色")]
public ColorCurveChannel colorLow = ColorCurveChannel.CreateDefault();
protected override void TriggerEvent(FeedbackContext context)
{
StrobeFlashShakeEvent.Trigger(
context,
context.duration,
modifyExtra,
frequencyCurve,
colorHigh,
colorLow
);
}
protected override void StopEvent(FeedbackContext context)
{
StrobeFlashShakeEvent.Trigger(context, 0f, stop: true);
}
public override bool Validate(out string error)
{
error = null;
return true;
}
}
}