Bezi回来了
This commit is contained in:
@@ -17,10 +17,15 @@ namespace Cielonos.MainGame.Effects.Feedback
|
||||
|
||||
public delegate void ShakeDelegate(
|
||||
FeedbackContext feedbackContext,
|
||||
bool modifyExposure,
|
||||
FloatCurveChannel exposureCurve,
|
||||
bool modifyContrast,
|
||||
FloatCurveChannel contrastCurve,
|
||||
bool modifySaturation,
|
||||
FloatCurveChannel saturationCurve,
|
||||
bool modifyHue,
|
||||
FloatCurveChannel hueCurve,
|
||||
bool modifyColorFilter,
|
||||
ColorCurveChannel colorFilterCurve,
|
||||
bool stop
|
||||
);
|
||||
@@ -30,14 +35,32 @@ namespace Cielonos.MainGame.Effects.Feedback
|
||||
|
||||
public static void Trigger(
|
||||
FeedbackContext feedbackContext,
|
||||
bool modifyExposure = false,
|
||||
FloatCurveChannel exposureCurve = default,
|
||||
bool modifyContrast = false,
|
||||
FloatCurveChannel contrastCurve = default,
|
||||
bool modifySaturation = false,
|
||||
FloatCurveChannel saturationCurve = default,
|
||||
bool modifyHue = false,
|
||||
FloatCurveChannel hueCurve = default,
|
||||
bool modifyColorFilter = false,
|
||||
ColorCurveChannel colorFilterCurve = default,
|
||||
bool stop = false)
|
||||
{
|
||||
OnEvent?.Invoke(feedbackContext, exposureCurve, contrastCurve, saturationCurve, hueCurve, colorFilterCurve, stop);
|
||||
OnEvent?.Invoke(
|
||||
feedbackContext,
|
||||
modifyExposure,
|
||||
exposureCurve,
|
||||
modifyContrast,
|
||||
contrastCurve,
|
||||
modifySaturation,
|
||||
saturationCurve,
|
||||
modifyHue,
|
||||
hueCurve,
|
||||
modifyColorFilter,
|
||||
colorFilterCurve,
|
||||
stop
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,26 +69,45 @@ namespace Cielonos.MainGame.Effects.Feedback
|
||||
/// </summary>
|
||||
public class AnimeACESShakeInstance : ShakeInstanceBase
|
||||
{
|
||||
public readonly FloatCurveChannel ExposureCurve;
|
||||
public readonly FloatCurveChannel ContrastCurve;
|
||||
public readonly FloatCurveChannel SaturationCurve;
|
||||
public readonly FloatCurveChannel HueCurve;
|
||||
public readonly ColorCurveChannel ColorFilterCurve;
|
||||
public readonly bool modifyExposure;
|
||||
public readonly FloatCurveChannel exposureCurve;
|
||||
|
||||
public readonly bool modifyContrast;
|
||||
public readonly FloatCurveChannel contrastCurve;
|
||||
|
||||
public readonly bool modifySaturation;
|
||||
public readonly FloatCurveChannel saturationCurve;
|
||||
|
||||
public readonly bool modifyHue;
|
||||
public readonly FloatCurveChannel hueCurve;
|
||||
|
||||
public readonly bool modifyColorFilter;
|
||||
public readonly ColorCurveChannel colorFilterCurve;
|
||||
|
||||
public AnimeACESShakeInstance(
|
||||
FeedbackContext feedbackContext,
|
||||
bool modifyExposure,
|
||||
FloatCurveChannel exposureCurve,
|
||||
bool modifyContrast,
|
||||
FloatCurveChannel contrastCurve,
|
||||
bool modifySaturation,
|
||||
FloatCurveChannel saturationCurve,
|
||||
bool modifyHue,
|
||||
FloatCurveChannel hueCurve,
|
||||
bool modifyColorFilter,
|
||||
ColorCurveChannel colorFilterCurve)
|
||||
: base(feedbackContext.timeSettings, feedbackContext.player.TimeProvider, feedbackContext.duration)
|
||||
{
|
||||
ExposureCurve = exposureCurve;
|
||||
ContrastCurve = contrastCurve;
|
||||
SaturationCurve = saturationCurve;
|
||||
HueCurve = hueCurve;
|
||||
ColorFilterCurve = colorFilterCurve;
|
||||
this.modifyExposure = modifyExposure;
|
||||
this.modifyContrast = modifyContrast;
|
||||
this.modifySaturation = modifySaturation;
|
||||
this.modifyHue = modifyHue;
|
||||
this.modifyColorFilter = modifyColorFilter;
|
||||
this.exposureCurve = exposureCurve;
|
||||
this.contrastCurve = contrastCurve;
|
||||
this.saturationCurve = saturationCurve;
|
||||
this.hueCurve = hueCurve;
|
||||
this.colorFilterCurve = colorFilterCurve;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,38 +157,39 @@ namespace Cielonos.MainGame.Effects.Feedback
|
||||
for (int i = _activeShakes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
AnimeACESShakeInstance shake = _activeShakes[i];
|
||||
shake.timer += shake.timeProvider.GetDeltaTime(shake.timeSettings);
|
||||
shake.Tick();
|
||||
|
||||
float normalizedTime = shake.timer / shake.duration;
|
||||
|
||||
// Exposure
|
||||
if (shake.ExposureCurve.active)
|
||||
if (shake.modifyExposure)
|
||||
{
|
||||
additiveExposure += shake.ExposureCurve.Evaluate(normalizedTime);
|
||||
additiveExposure += shake.exposureCurve.Evaluate(normalizedTime);
|
||||
Debug.Log($"Exposure shake: {additiveExposure}");
|
||||
}
|
||||
|
||||
// Contrast
|
||||
if (shake.ContrastCurve.active)
|
||||
if (shake.modifyContrast)
|
||||
{
|
||||
additiveContrast += shake.ContrastCurve.Evaluate(normalizedTime);
|
||||
additiveContrast += shake.contrastCurve.Evaluate(normalizedTime);
|
||||
}
|
||||
|
||||
// Saturation
|
||||
if (shake.SaturationCurve.active)
|
||||
if (shake.modifySaturation)
|
||||
{
|
||||
additiveSaturation += shake.SaturationCurve.Evaluate(normalizedTime);
|
||||
additiveSaturation += shake.saturationCurve.Evaluate(normalizedTime);
|
||||
}
|
||||
|
||||
// Hue
|
||||
if (shake.HueCurve.active)
|
||||
if (shake.modifyHue)
|
||||
{
|
||||
additiveHue += shake.HueCurve.Evaluate(normalizedTime);
|
||||
additiveHue += shake.hueCurve.Evaluate(normalizedTime);
|
||||
}
|
||||
|
||||
// Color Filter
|
||||
if (shake.ColorFilterCurve.active)
|
||||
if (shake.modifyColorFilter)
|
||||
{
|
||||
colorFilterAccum = shake.ColorFilterCurve.Evaluate(normalizedTime);
|
||||
colorFilterAccum = shake.colorFilterCurve.Evaluate(normalizedTime);
|
||||
hasColorFilter = true;
|
||||
}
|
||||
|
||||
@@ -171,10 +214,15 @@ namespace Cielonos.MainGame.Effects.Feedback
|
||||
|
||||
private void OnShakeEvent(
|
||||
FeedbackContext feedbackContext,
|
||||
bool modifyExposure,
|
||||
FloatCurveChannel exposureCurve,
|
||||
bool modifyContrast,
|
||||
FloatCurveChannel contrastCurve,
|
||||
bool modifySaturation,
|
||||
FloatCurveChannel saturationCurve,
|
||||
bool modifyHue,
|
||||
FloatCurveChannel hueCurve,
|
||||
bool modifyColorFilter,
|
||||
ColorCurveChannel colorFilterCurve,
|
||||
bool stop)
|
||||
{
|
||||
@@ -184,12 +232,11 @@ namespace Cielonos.MainGame.Effects.Feedback
|
||||
|
||||
var instance = new AnimeACESShakeInstance(
|
||||
feedbackContext,
|
||||
exposureCurve,
|
||||
contrastCurve,
|
||||
saturationCurve,
|
||||
hueCurve,
|
||||
colorFilterCurve
|
||||
);
|
||||
modifyExposure, exposureCurve,
|
||||
modifyContrast, contrastCurve,
|
||||
modifySaturation, saturationCurve,
|
||||
modifyHue, hueCurve,
|
||||
modifyColorFilter, colorFilterCurve);
|
||||
_activeShakes.Add(instance);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user