Insanely huge initial commit

This commit is contained in:
2026-02-21 17:04:05 -08:00
parent 9cdd36191a
commit 613d75914a
22525 changed files with 4035207 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a5a12cd7956445649a4fff949522c747
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 84e663f9474fbea4789d09171e495a02
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,98 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control bloom intensity and threshold over time. It requires you have in your scene an object with a Volume with Bloom active, and a MMBloomShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control bloom intensity and threshold over time. It requires you have in your scene an object with a Volume " +
"with Bloom active, and a MMBloomShaker_URP component.")]
[FeedbackPath("PostProcess/Bloom URP")]
public class MMFeedbackBloom_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Bloom")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the feedback, in seconds
[Tooltip("the duration of the feedback, in seconds")]
public float ShakeDuration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeValues = true;
[Header("Intensity")]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve ShakeIntensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapIntensityOne = 1f;
[Header("Threshold")]
/// the curve to animate the threshold on
[Tooltip("the curve to animate the threshold on")]
public AnimationCurve ShakeThreshold = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapThresholdZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapThresholdOne = 0f;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
/// <summary>
/// Triggers a bloom shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float attenuation = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMBloomShakeEvent_URP.Trigger(ShakeIntensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, ShakeThreshold, RemapThresholdZero, RemapThresholdOne,
RelativeValues, attenuation, ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMBloomShakeEvent_URP.Trigger(ShakeIntensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, ShakeThreshold, RemapThresholdZero, RemapThresholdOne,
RelativeValues, channelData:ChannelData(Channel), stop: true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9df87e1a2ab37ad44979fcf4aeb59d95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,127 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control channel mixer's red, green and blue over time.
/// It requires you have in your scene an object with a Volume
/// with Channel Mixer active, and a MMChannelMixerShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackPath("PostProcess/Channel Mixer URP")]
[FeedbackHelp("This feedback allows you to control channel mixer's red, green and blue over time." +
"It requires you have in your scene an object with a Volume" +
"with Channel Mixer active, and a MMChannelMixerShaker_URP component.")]
public class MMFeedbackChannelMixer_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Color Grading")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float ShakeDuration = 1f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = true;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[Header("Red")]
/// the curve used to animate the red value on
[Tooltip("the curve used to animate the red value on")]
public AnimationCurve ShakeRed = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-200f, 200f)]
public float RemapRedZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-200f, 200f)]
public float RemapRedOne = 200f;
[Header("Green")]
/// the curve used to animate the green value on
[Tooltip("the curve used to animate the green value on")]
public AnimationCurve ShakeGreen = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-200f, 200f)]
public float RemapGreenZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-200f, 200f)]
public float RemapGreenOne = 200f;
[Header("Blue")]
/// the curve used to animate the blue value on
[Tooltip("the curve used to animate the blue value on")]
public AnimationCurve ShakeBlue = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-200f, 200f)]
public float RemapBlueZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-200f, 200f)]
public float RemapBlueOne = 200f;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
/// <summary>
/// Triggers a color adjustments shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMChannelMixerShakeEvent_URP.Trigger(ShakeRed, RemapRedZero, RemapRedOne,
ShakeGreen, RemapGreenZero, RemapGreenOne,
ShakeBlue, RemapBlueZero, RemapBlueOne,
FeedbackDuration,
RelativeIntensity, intensityMultiplier, ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMChannelMixerShakeEvent_URP.Trigger(ShakeRed, RemapRedZero, RemapRedOne,
ShakeGreen, RemapGreenZero, RemapGreenOne,
ShakeBlue, RemapBlueZero, RemapBlueOne,
FeedbackDuration,
RelativeIntensity, channelData:ChannelData(Channel), stop:true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3df922671fba5794db08828709538dfd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,96 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control chromatic aberration intensity over time. It requires you have in your scene an object with a Volume
/// with URP Chromatic Aberration active, and a MMChromaticAberrationShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackPath("PostProcess/Chromatic Aberration URP")]
[FeedbackHelp("This feedback allows you to control chromatic aberration intensity over time. It requires you have in your scene an object with a Volume " +
"with Chromatic Aberration active, and a MMChromaticAberrationShaker_URP component.")]
public class MMFeedbackChromaticAberration_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Chromatic Aberration")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1f;
[Header("Intensity")]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the multiplier to apply to the intensity curve
[Tooltip("the multiplier to apply to the intensity curve")]
[Range(0f, 1f)]
public float Amplitude = 1.0f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = false;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
/// <summary>
/// Triggers a chromatic aberration shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMChromaticAberrationShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMChromaticAberrationShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, channelData:ChannelData(Channel), stop:true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 14177e637dc9949429cf13864ad93db3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,167 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control color adjustments' post exposure, hue shift, saturation and contrast over time.
/// It requires you have in your scene an object with a Volume
/// with Color Adjustments active, and a MMColorAdjustmentsShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackPath("PostProcess/Color Adjustments URP")]
[FeedbackHelp("This feedback allows you to control color adjustments' post exposure, hue shift, saturation and contrast over time. " +
"It requires you have in your scene an object with a Volume " +
"with Color Adjustments active, and a MMColorAdjustmentsShaker_URP component.")]
public class MMFeedbackColorAdjustments_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Color Grading")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float ShakeDuration = 1f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = true;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[Header("Post Exposure")]
/// the curve used to animate the focus distance value on
[Tooltip("the curve used to animate the focus distance value on")]
public AnimationCurve ShakePostExposure = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapPostExposureZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapPostExposureOne = 1f;
[Header("Hue Shift")]
/// the curve used to animate the aperture value on
[Tooltip("the curve used to animate the aperture value on")]
public AnimationCurve ShakeHueShift = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-180f, 180f)]
public float RemapHueShiftZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-180f, 180f)]
public float RemapHueShiftOne = 180f;
[Header("Saturation")]
/// the curve used to animate the focal length value on
[Tooltip("the curve used to animate the focal length value on")]
public AnimationCurve ShakeSaturation = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapSaturationZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapSaturationOne = 100f;
[Header("Contrast")]
/// the curve used to animate the focal length value on
[Tooltip("the curve used to animate the focal length value on")]
public AnimationCurve ShakeContrast = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapContrastZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapContrastOne = 100f;
[Header("Color Filter")]
/// the selected color filter mode :
/// None : nothing will happen,
/// gradient : evaluates the color over time on that gradient, from left to right,
/// interpolate : lerps from the current color to the destination one
[Tooltip("the selected color filter mode :" +
"None : nothing will happen," +
"gradient : evaluates the color over time on that gradient, from left to right," +
"interpolate : lerps from the current color to the destination one ")]
public MMColorAdjustmentsShaker_URP.ColorFilterModes ColorFilterMode = MMColorAdjustmentsShaker_URP.ColorFilterModes.None;
/// the gradient to use to animate the color filter over time
[Tooltip("the gradient to use to animate the color filter over time")]
[MMFEnumCondition("ColorFilterMode", (int)MMColorAdjustmentsShaker_URP.ColorFilterModes.Gradient)]
[GradientUsage(true)]
public Gradient ColorFilterGradient;
/// the destination color when in interpolate mode
[Tooltip("the destination color when in interpolate mode")]
[MMFEnumCondition("ColorFilterMode", (int) MMColorAdjustmentsShaker_URP.ColorFilterModes.Interpolate)]
public Color ColorFilterDestination = Color.yellow;
/// the curve to use when interpolating towards the destination color
[Tooltip("the curve to use when interpolating towards the destination color")]
[MMFEnumCondition("ColorFilterMode", (int) MMColorAdjustmentsShaker_URP.ColorFilterModes.Interpolate)]
public AnimationCurve ColorFilterCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
/// <summary>
/// Triggers a color adjustments shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMColorAdjustmentsShakeEvent_URP.Trigger(ShakePostExposure, RemapPostExposureZero, RemapPostExposureOne,
ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne,
ShakeSaturation, RemapSaturationZero, RemapSaturationOne,
ShakeContrast, RemapContrastZero, RemapContrastOne,
ColorFilterMode, ColorFilterGradient, ColorFilterDestination, ColorFilterCurve,
FeedbackDuration,
RelativeIntensity, intensityMultiplier, ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMColorAdjustmentsShakeEvent_URP.Trigger(ShakePostExposure, RemapPostExposureZero, RemapPostExposureOne,
ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne,
ShakeSaturation, RemapSaturationZero, RemapSaturationOne,
ShakeContrast, RemapContrastZero, RemapContrastOne,
ColorFilterMode, ColorFilterGradient, ColorFilterDestination, ColorFilterCurve,
FeedbackDuration,
RelativeIntensity, channelData:ChannelData(Channel), stop: true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a1cba05e4f75e82489426a0f40143740
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,123 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP depth of field focus distance, aperture and focal length over time.
/// It requires you have in your scene an object with a Volume
/// with Depth of Field active, and a MMDepthOfFieldShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control URP depth of field focus distance, aperture and focal length over time. " +
"It requires you have in your scene an object with a Volume " +
"with Depth of Field active, and a MMDepthOfFieldShaker_URP component.")]
[FeedbackPath("PostProcess/Depth Of Field URP")]
public class MMFeedbackDepthOfField_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Depth Of Field")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float ShakeDuration = 2f;
/// whether or not to add to the initial values
[Tooltip("whether or not to add to the initial values")]
public bool RelativeValues = true;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[Header("Focus Distance")]
/// the curve used to animate the focus distance value on
[Tooltip("the curve used to animate the focus distance value on")]
public AnimationCurve ShakeFocusDistance = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapFocusDistanceZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapFocusDistanceOne = 3f;
[Header("Aperture")]
/// the curve used to animate the aperture value on
[Tooltip("the curve used to animate the aperture value on")]
public AnimationCurve ShakeAperture = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0.1f, 32f)]
public float RemapApertureZero = .1f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0.1f, 32f)]
public float RemapApertureOne = 32f;
[Header("Focal Length")]
/// the curve used to animate the focal length value on
[Tooltip("the curve used to animate the focal length value on")]
public AnimationCurve ShakeFocalLength = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 300f)]
public float RemapFocalLengthZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 300f)]
public float RemapFocalLengthOne = 0f;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
/// <summary>
/// Triggers a depth of field event
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
ShakeAperture, RemapApertureZero, RemapApertureOne,
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
RelativeValues, intensityMultiplier, ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
ShakeAperture, RemapApertureZero, RemapApertureOne,
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
RelativeValues, channelData:ChannelData(Channel), stop: true );
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cc0a04a6c76f67645a70b2a4fd9fa53c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,95 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP Film Grain intensity over time.
/// It requires you have in your scene an object with a Volume
/// with Film Grain active, and a MMFilmGrainShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackPath("PostProcess/Film Grain URP")]
[FeedbackHelp("This feedback allows you to control Film Grain intensity over time. " +
"It requires you have in your scene an object with a Volume " +
"with Film Grain active, and a MMFilmGrainShaker_URP component.")]
public class MMFeedbackFilmGrain_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Film Grain")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[Header("Intensity")]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's zero to
[Tooltip("the value to remap the curve's zero to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's one to
[Tooltip("the value to remap the curve's one to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1.0f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = false;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
/// <summary>
/// Triggers a Film Grain shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop:true, channelData:ChannelData(Channel));
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bb3c7310d68d8b647b1d5cabaa32508e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,142 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you pilot a Global PostProcessing Volume AutoBlend URP component. A GPPVAB component is placed on a PostProcessing Volume, and will let you control and blend its weight over time on demand.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you pilot a Global PostProcessing Volume AutoBlend URP component. A GPPVAB component is placed on a PostProcessing Volume, and will let you control and blend its weight over time on demand.")]
[FeedbackPath("PostProcess/Global PP Volume Auto Blend URP")]
public class MMFeedbackGlobalPPVolumeAutoBlend_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// the possible modes for this feedback :
/// - default : will let you trigger Blend() and BlendBack() on the blender
/// - override : lets you specify new initial, final, duration and curve values on the blender, and triggers a Blend()
public enum Modes { Default, Override }
/// the possible actions when in Default mode
public enum Actions { Blend, BlendBack }
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// defines the duration of the feedback
public override float FeedbackDuration
{
get
{
if (Mode == Modes.Override)
{
return ApplyTimeMultiplier(BlendDuration);
}
else
{
if (TargetAutoBlend == null)
{
return 0.1f;
}
else
{
return ApplyTimeMultiplier(TargetAutoBlend.BlendDuration);
}
}
}
set
{
BlendDuration = value;
if (TargetAutoBlend != null)
{
TargetAutoBlend.BlendDuration = value;
}
}
}
[Header("PostProcess Volume Blend")]
/// the target auto blend to pilot with this feedback
public MMGlobalPostProcessingVolumeAutoBlend_URP TargetAutoBlend;
/// the chosen mode
public Modes Mode = Modes.Default;
/// the chosen action when in default mode
[MMFEnumCondition("Mode", (int)Modes.Default)]
public Actions BlendAction = Actions.Blend;
/// the duration of the blend, in seconds when in override mode
[MMFEnumCondition("Mode", (int)Modes.Override)]
public float BlendDuration = 1f;
/// the curve to apply to the blend
[MMFEnumCondition("Mode", (int)Modes.Override)]
public AnimationCurve BlendCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1f));
/// the weight to blend from
[MMFEnumCondition("Mode", (int)Modes.Override)]
public float InitialWeight = 0f;
/// the weight to blend to
[MMFEnumCondition("Mode", (int)Modes.Override)]
public float FinalWeight = 1f;
/// <summary>
/// On custom play, triggers a blend on the target blender, overriding its settings if needed
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
if (TargetAutoBlend == null)
{
Debug.LogWarning(this.name + " : this MMFeedbackGlobalPPVolumeAutoBlend needs a TargetAutoBlend, please set one in its inspector.");
return;
}
if (Mode == Modes.Default)
{
if (BlendAction == Actions.Blend)
{
TargetAutoBlend.Blend();
return;
}
if (BlendAction == Actions.BlendBack)
{
TargetAutoBlend.BlendBack();
return;
}
}
else
{
TargetAutoBlend.BlendDuration = FeedbackDuration;
TargetAutoBlend.Curve = BlendCurve;
TargetAutoBlend.InitialWeight = InitialWeight;
TargetAutoBlend.FinalWeight = FinalWeight;
TargetAutoBlend.Blend();
}
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
if (TargetAutoBlend != null)
{
TargetAutoBlend.StopBlending();
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad81c5a41b7d8e74b8b5e1ba6bd734bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,104 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP lens distortion intensity over time.
/// It requires you have in your scene an object with a Volume
/// with Lens Distortion active, and a MMLensDistortionShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackPath("PostProcess/Lens Distortion URP")]
[FeedbackHelp("This feedback allows you to control URP lens distortion intensity over time. " +
"It requires you have in your scene an object with a Volume " +
"with Lens Distortion active, and a MMLensDistortionShaker_URP component.")]
public class MMFeedbackLensDistortion_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Lens Distortion")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake in seconds
[Tooltip("the duration of the shake in seconds")]
public float Duration = 0.8f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[Header("Intensity")]
/// whether or not to add to the initial intensity value
[Tooltip("whether or not to add to the initial intensity value")]
public bool RelativeIntensity = false;
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0),
new Keyframe(0.2f, 1),
new Keyframe(0.25f, -1),
new Keyframe(0.35f, 0.7f),
new Keyframe(0.4f, -0.7f),
new Keyframe(0.6f, 0.3f),
new Keyframe(0.65f, -0.3f),
new Keyframe(0.8f, 0.1f),
new Keyframe(0.85f, -0.1f),
new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapIntensityOne = 0.5f;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
/// <summary>
/// Triggers a lens distortion shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMLensDistortionShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMLensDistortionShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop:true, channelData:ChannelData(Channel));
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 97cf02ff6758a9c43a0425f7a81b3575
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,95 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP motion blur intensity over time.
/// It requires you have in your scene an object with a Volume
/// with MotionBlur active, and a MMMotionBlurShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackPath("PostProcess/Motion Blur URP")]
[FeedbackHelp("This feedback allows you to control motion blur intensity over time. " +
"It requires you have in your scene an object with a Volume " +
"with MotionBlur active, and a MMMotionBlurShaker_URP component.")]
public class MMFeedbackMotionBlur_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Motion Blur")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[Header("Intensity")]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to which to remap the curve's zero to
[Tooltip("the value to which to remap the curve's zero to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to which to remap the curve's one to
[Tooltip("the value to which to remap the curve's one to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1.0f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = false;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
/// <summary>
/// Triggers a motion blur shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMMotionBlurShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMMotionBlurShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop: true, channelData:ChannelData(Channel));
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 60aaa89675f08fe46a3472284d415de4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,94 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control Panini Projection distance and crop to fit over time.
/// It requires you have in your scene an object with a Volume with Bloom active, and a MMPaniniProjectionShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control Panini Projection distance and crop to fit over time. " +
"It requires you have in your scene an object with a Volume " +
"with PaniniProjection active, and a MMPaniniProjectionShaker_URP component.")]
[FeedbackPath("PostProcess/Panini Projection URP")]
public class MMFeedbackPaniniProjection_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Panini Projection")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[Header("Distance")]
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeDistance = false;
/// the curve used to animate the distance value on
[Tooltip("the curve used to animate the distance value on")]
public AnimationCurve ShakeDistance = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 1f)]
public float RemapDistanceZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 1f)]
public float RemapDistanceOne = 1f;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
/// <summary>
/// Triggers a bloom shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero, RemapDistanceOne, RelativeDistance, intensityMultiplier, ChannelData(Channel),
ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero, RemapDistanceOne, RelativeDistance, channelData: ChannelData(Channel), stop: true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e6dddb1605bb24544b32453923eeb0e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,95 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP vignette intensity over time.
/// It requires you have in your scene an object with a Volume
/// with Vignette active, and a MMVignetteShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackPath("PostProcess/Vignette URP")]
[FeedbackHelp("This feedback allows you to control vignette intensity over time. " +
"It requires you have in your scene an object with a Volume " +
"with Vignette active, and a MMVignetteShaker_URP component.")]
public class MMFeedbackVignette_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("Vignette")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[Header("Intensity")]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's zero to
[Tooltip("the value to remap the curve's zero to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's one to
[Tooltip("the value to remap the curve's one to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1.0f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = false;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
/// <summary>
/// Triggers a vignette shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
base.CustomStopFeedback(position, feedbacksIntensity);
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop: true, channelData:ChannelData(Channel));
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 132935fb36951d349a25a3cc5a8d8bc7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,110 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control white balance temperature and tint over time.
/// It requires you have in your scene an object with a Volume with White Balance active, and a MMWhiteBalanceShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control white balance temperature and tint over time. " +
"It requires you have in your scene an object with a Volume " +
"with WhiteBalance active, and a MMWhiteBalanceShaker_URP component.")]
[FeedbackPath("PostProcess/White Balance URP")]
public class MMFeedbackWhiteBalance_URP : MMFeedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
[Header("White Balance")]
/// the channel to emit on
[Tooltip("the channel to emit on")]
public int Channel = 0;
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float ShakeDuration = 1f;
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeValues = true;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[Header("Temperature")]
/// the curve used to animate the temperature value on
[Tooltip("the curve used to animate the temperature value on")]
public AnimationCurve ShakeTemperature = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapTemperatureZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapTemperatureOne = 100f;
[Header("Tint")]
/// the curve used to animate the tint value on
[Tooltip("the curve used to animate the tint value on")]
public AnimationCurve ShakeTint = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapTintZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapTintOne = 100f;
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
/// <summary>
/// Triggers a white balance shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity;
MMWhiteBalanceShakeEvent_URP.Trigger(ShakeTemperature, FeedbackDuration, RemapTemperatureZero, RemapTemperatureOne,
ShakeTint, RemapTintZero, RemapTintOne, RelativeValues, intensityMultiplier,
ChannelData(Channel), ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, Timing.TimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMWhiteBalanceShakeEvent_URP.Trigger(ShakeTemperature, FeedbackDuration, RemapTemperatureZero, RemapTemperatureOne,
ShakeTint, RemapTintZero, RemapTintOne, RelativeValues, stop: true, channelData:ChannelData(Channel));
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 989f4f7f32890ce4ba7d98fd9fb0405b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control bloom intensity and threshold over time. It requires you have in your scene an object with a Volume with Bloom active, and a MMBloomShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control bloom intensity and threshold over time. It requires you have in your scene an object with a Volume " +
"with Bloom active, and a MMBloomShaker_URP component.")]
#if MM_URP
[FeedbackPath("PostProcess/Bloom URP")]
#endif
public class MMF_Bloom_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Bloom", true, 41)]
/// the duration of the feedback, in seconds
[Tooltip("the duration of the feedback, in seconds")]
public float ShakeDuration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeValues = true;
[MMFInspectorGroup("Intensity", true, 42)]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve ShakeIntensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapIntensityOne = 1f;
[MMFInspectorGroup("Threshold", true, 43)]
/// the curve to animate the threshold on
[Tooltip("the curve to animate the threshold on")]
public AnimationCurve ShakeThreshold = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapThresholdZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapThresholdOne = 0f;
/// <summary>
/// Triggers a bloom shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float attenuation = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
attenuation = ComputeIntensity(attenuation, position);
MMBloomShakeEvent_URP.Trigger(ShakeIntensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, ShakeThreshold, RemapThresholdZero, RemapThresholdOne,
RelativeValues, attenuation, ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMBloomShakeEvent_URP.Trigger(ShakeIntensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne,
ShakeThreshold, RemapThresholdZero, RemapThresholdOne,
RelativeValues, channelData:ChannelData, stop: true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMBloomShakeEvent_URP.Trigger(ShakeIntensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne,
ShakeThreshold, RemapThresholdZero, RemapThresholdOne,
RelativeValues, channelData:ChannelData, restore: true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2745b12389b632b4793a46c0329b78a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,141 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control bloom intensity and threshold over time. It requires you have in your scene an object with a Volume with Bloom active, and a MMBloomShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control bloom intensity and threshold over time. It requires you have in your scene an object with a Volume " +
"with Bloom active, and a MMBloomShaker_URP component.")]
#if MM_URP
[FeedbackPath("PostProcess/Channel Mixer URP")]
#endif
public class MMF_ChannelMixer_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Channel Mixer", true, 41)]
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float ShakeDuration = 1f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = true;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[MMFInspectorGroup("Red", true, 42)]
/// the curve used to animate the red value on
[Tooltip("the curve used to animate the red value on")]
public AnimationCurve ShakeRed = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-200f, 200f)]
public float RemapRedZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-200f, 200f)]
public float RemapRedOne = -200f;
[MMFInspectorGroup("Green", true, 43)]
/// the curve used to animate the green value on
[Tooltip("the curve used to animate the green value on")]
public AnimationCurve ShakeGreen = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-200f, 200f)]
public float RemapGreenZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-200f, 200f)]
public float RemapGreenOne = 200f;
[MMFInspectorGroup("Blue", true, 44)]
/// the curve used to animate the blue value on
[Tooltip("the curve used to animate the blue value on")]
public AnimationCurve ShakeBlue = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-200f, 200f)]
public float RemapBlueZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-200f, 200f)]
public float RemapBlueOne = 200f;
/// <summary>
/// Triggers a color adjustments shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMChannelMixerShakeEvent_URP.Trigger(ShakeRed, RemapRedZero, RemapRedOne,
ShakeGreen, RemapGreenZero, RemapGreenOne,
ShakeBlue, RemapBlueZero, RemapBlueOne,
FeedbackDuration,
RelativeIntensity, intensityMultiplier, ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMChannelMixerShakeEvent_URP.Trigger(ShakeRed, RemapRedZero, RemapRedOne,
ShakeGreen, RemapGreenZero, RemapGreenOne,
ShakeBlue, RemapBlueZero, RemapBlueOne,
FeedbackDuration,
RelativeIntensity, channelData:ChannelData, stop:true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMChannelMixerShakeEvent_URP.Trigger(ShakeRed, RemapRedZero, RemapRedOne,
ShakeGreen, RemapGreenZero, RemapGreenOne,
ShakeBlue, RemapBlueZero, RemapBlueOne,
FeedbackDuration,
RelativeIntensity, channelData:ChannelData, restore:true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 91ee58105ec38c84b905bd3f290dd6b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,109 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control chromatic aberration intensity over time. It requires you have in your scene an object with a Volume
/// with URP Chromatic Aberration active, and a MMChromaticAberrationShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control chromatic aberration intensity over time. It requires you have in your scene an object with a Volume " +
"with Chromatic Aberration active, and a MMChromaticAberrationShaker_URP component.")]
#if MM_URP
[FeedbackPath("PostProcess/Chromatic Aberration URP")]
#endif
public class MMF_ChromaticAberration_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Chromatic Aberration", true, 42)]
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1f;
[MMFInspectorGroup("Intensity", true, 43)]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the multiplier to apply to the intensity curve
[Tooltip("the multiplier to apply to the intensity curve")]
[Range(0f, 1f)]
public float Amplitude = 1.0f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = false;
/// <summary>
/// Triggers a chromatic aberration shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMChromaticAberrationShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMChromaticAberrationShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, channelData:ChannelData, stop:true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMChromaticAberrationShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, channelData:ChannelData, restore:true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e5d6c0f2232e3b149b9e1b618c6f9592
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,186 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control color adjustments' post exposure, hue shift, saturation and contrast over time.
/// It requires you have in your scene an object with a Volume
/// with Color Adjustments active, and a MMColorAdjustmentsShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control color adjustments' post exposure, hue shift, saturation and contrast over time. " +
"It requires you have in your scene an object with a Volume " +
"with Color Adjustments active, and a MMColorAdjustmentsShaker_URP component.")]
#if MM_URP
[FeedbackPath("PostProcess/Color Adjustments URP")]
#endif
public class MMF_ColorAdjustments_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Color Grading", true, 43)]
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float ShakeDuration = 1f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = true;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[MMFInspectorGroup("Post Exposure", true, 48)]
/// the curve used to animate the focus distance value on
[Tooltip("the curve used to animate the focus distance value on")]
public AnimationCurve ShakePostExposure = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapPostExposureZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapPostExposureOne = 1f;
[MMFInspectorGroup("Hue Shift", true, 47)]
/// the curve used to animate the aperture value on
[Tooltip("the curve used to animate the aperture value on")]
public AnimationCurve ShakeHueShift = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-180f, 180f)]
public float RemapHueShiftZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-180f, 180f)]
public float RemapHueShiftOne = 180f;
[MMFInspectorGroup("Saturation", true, 46)]
/// the curve used to animate the focal length value on
[Tooltip("the curve used to animate the focal length value on")]
public AnimationCurve ShakeSaturation = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapSaturationZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapSaturationOne = 100f;
[MMFInspectorGroup("Contrast", true, 45)]
/// the curve used to animate the focal length value on
[Tooltip("the curve used to animate the focal length value on")]
public AnimationCurve ShakeContrast = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapContrastZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapContrastOne = 100f;
[MMFInspectorGroup("Color Filter", true, 44)]
/// the selected color filter mode :
/// None : nothing will happen,
/// gradient : evaluates the color over time on that gradient, from left to right,
/// interpolate : lerps from the current color to the destination one
[Tooltip("the selected color filter mode :" +
"None : nothing will happen," +
"gradient : evaluates the color over time on that gradient, from left to right," +
"interpolate : lerps from the current color to the destination one ")]
public MMColorAdjustmentsShaker_URP.ColorFilterModes ColorFilterMode = MMColorAdjustmentsShaker_URP.ColorFilterModes.None;
/// the gradient to use to animate the color filter over time
[Tooltip("the gradient to use to animate the color filter over time")]
[MMFEnumCondition("ColorFilterMode", (int)MMColorAdjustmentsShaker_URP.ColorFilterModes.Gradient)]
[GradientUsage(true)]
public Gradient ColorFilterGradient;
/// the destination color when in interpolate mode
[Tooltip("the destination color when in interpolate mode")]
[MMFEnumCondition("ColorFilterMode", (int) MMColorAdjustmentsShaker_URP.ColorFilterModes.Interpolate)]
public Color ColorFilterDestination = Color.yellow;
/// the curve to use when interpolating towards the destination color
[Tooltip("the curve to use when interpolating towards the destination color")]
[MMFEnumCondition("ColorFilterMode", (int) MMColorAdjustmentsShaker_URP.ColorFilterModes.Interpolate)]
public AnimationCurve ColorFilterCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// <summary>
/// Triggers a color adjustments shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMColorAdjustmentsShakeEvent_URP.Trigger(ShakePostExposure, RemapPostExposureZero, RemapPostExposureOne,
ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne,
ShakeSaturation, RemapSaturationZero, RemapSaturationOne,
ShakeContrast, RemapContrastZero, RemapContrastOne,
ColorFilterMode, ColorFilterGradient, ColorFilterDestination, ColorFilterCurve,
FeedbackDuration,
RelativeIntensity, intensityMultiplier, ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMColorAdjustmentsShakeEvent_URP.Trigger(ShakePostExposure, RemapPostExposureZero, RemapPostExposureOne,
ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne,
ShakeSaturation, RemapSaturationZero, RemapSaturationOne,
ShakeContrast, RemapContrastZero, RemapContrastOne,
ColorFilterMode, ColorFilterGradient, ColorFilterDestination, ColorFilterCurve,
FeedbackDuration,
RelativeIntensity, channelData: ChannelData, stop: true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMColorAdjustmentsShakeEvent_URP.Trigger(ShakePostExposure, RemapPostExposureZero, RemapPostExposureOne,
ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne,
ShakeSaturation, RemapSaturationZero, RemapSaturationOne,
ShakeContrast, RemapContrastZero, RemapContrastOne,
ColorFilterMode, ColorFilterGradient, ColorFilterDestination, ColorFilterCurve,
FeedbackDuration,
RelativeIntensity, channelData: ChannelData, restore: true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d72ca77766228434bac267331d9890d6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,139 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP depth of field focus distance, aperture and focal length over time.
/// It requires you have in your scene an object with a Volume
/// with Depth of Field active, and a MMDepthOfFieldShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control URP depth of field focus distance, aperture and focal length over time. " +
"It requires you have in your scene an object with a Volume " +
"with Depth of Field active, and a MMDepthOfFieldShaker_URP component.")]
#if MM_URP
[FeedbackPath("PostProcess/Depth Of Field URP")]
#endif
public class MMF_DepthOfField_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Depth Of Field", true, 49)]
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float ShakeDuration = 2f;
/// whether or not to add to the initial values
[Tooltip("whether or not to add to the initial values")]
public bool RelativeValues = true;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[MMFInspectorGroup("Focus Distance", true, 50)]
/// the curve used to animate the focus distance value on
[Tooltip("the curve used to animate the focus distance value on")]
public AnimationCurve ShakeFocusDistance = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapFocusDistanceZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapFocusDistanceOne = 3f;
[MMFInspectorGroup("Aperture", true, 51)]
/// the curve used to animate the aperture value on
[Tooltip("the curve used to animate the aperture value on")]
public AnimationCurve ShakeAperture = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0.1f, 32f)]
public float RemapApertureZero = .1f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0.1f, 32f)]
public float RemapApertureOne = 32f;
[MMFInspectorGroup("Focal Length", true, 20)]
/// the curve used to animate the focal length value on
[Tooltip("the curve used to animate the focal length value on")]
public AnimationCurve ShakeFocalLength = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 300f)]
public float RemapFocalLengthZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 300f)]
public float RemapFocalLengthOne = 0f;
/// <summary>
/// Triggers a depth of field event
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
ShakeAperture, RemapApertureZero, RemapApertureOne,
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
RelativeValues, intensityMultiplier, ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
ShakeAperture, RemapApertureZero, RemapApertureOne,
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
RelativeValues, channelData: ChannelData, stop: true );
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
ShakeAperture, RemapApertureZero, RemapApertureOne,
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
RelativeValues, channelData: ChannelData, restore: true );
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 951e153e1b6cbb442865fac50d3ea0db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,108 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP Film Grain intensity over time.
/// It requires you have in your scene an object with a Volume
/// with Film Grain active, and a MMFilmGrainShaker_URP component.
/// </summary>
[AddComponentMenu("")]
#if MM_URP
[FeedbackPath("PostProcess/Film Grain URP")]
#endif
[FeedbackHelp("This feedback allows you to control Film Grain intensity over time. " +
"It requires you have in your scene an object with a Volume " +
"with Film Grain active, and a MMFilmGrainShaker_URP component.")]
public class MMF_FilmGrain_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Film Grain", true, 21)]
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[MMFInspectorGroup("Intensity", true, 22)]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's zero to
[Tooltip("the value to remap the curve's zero to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's one to
[Tooltip("the value to remap the curve's one to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1.0f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = false;
/// <summary>
/// Triggers a Film Grain shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop:true, channelData: ChannelData);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, restore:true, channelData: ChannelData);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 78ba34f29f369984099f450eb0a6777c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,159 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you pilot a Global PostProcessing Volume AutoBlend URP component. A GPPVAB component is placed on a PostProcessing Volume, and will let you control and blend its weight over time on demand.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you pilot a Global PostProcessing Volume AutoBlend URP component. A GPPVAB component is placed on a PostProcessing Volume, and will let you control and blend its weight over time on demand.")]
#if MM_URP
[FeedbackPath("PostProcess/Global PP Volume Auto Blend URP")]
#endif
public class MMF_GlobalPPVolumeAutoBlend_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// the possible modes for this feedback :
/// - default : will let you trigger Blend() and BlendBack() on the blender
/// - override : lets you specify new initial, final, duration and curve values on the blender, and triggers a Blend()
public enum Modes { Default, Override }
/// the possible actions when in Default mode
public enum Actions { Blend, BlendBack }
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
public override bool EvaluateRequiresSetup() { return (TargetAutoBlend == null); }
public override string RequiredTargetText { get { return TargetAutoBlend != null ? TargetAutoBlend.name : ""; } }
public override string RequiresSetupText { get { return "This feedback requires that a TargetCanvasGroup be set to be able to work properly. You can set one below."; } }
#endif
/// defines the duration of the feedback
public override float FeedbackDuration
{
get
{
if (Mode == Modes.Override)
{
return ApplyTimeMultiplier(BlendDuration);
}
else
{
if (TargetAutoBlend == null)
{
return 0.1f;
}
else
{
return ApplyTimeMultiplier(TargetAutoBlend.BlendDuration);
}
}
}
set
{
BlendDuration = value;
if (TargetAutoBlend != null)
{
TargetAutoBlend.BlendDuration = value;
}
}
}
[MMFInspectorGroup("PostProcess Volume Blend", true, 22, true)]
/// the target auto blend to pilot with this feedback
public MMGlobalPostProcessingVolumeAutoBlend_URP TargetAutoBlend;
/// the chosen mode
public Modes Mode = Modes.Default;
/// the chosen action when in default mode
[MMFEnumCondition("Mode", (int)Modes.Default)]
public Actions BlendAction = Actions.Blend;
/// the duration of the blend, in seconds when in override mode
[MMFEnumCondition("Mode", (int)Modes.Override)]
public float BlendDuration = 1f;
/// the curve to apply to the blend
[MMFEnumCondition("Mode", (int)Modes.Override)]
public AnimationCurve BlendCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1f));
/// the weight to blend from
[MMFEnumCondition("Mode", (int)Modes.Override)]
public float InitialWeight = 0f;
/// the weight to blend to
[MMFEnumCondition("Mode", (int)Modes.Override)]
public float FinalWeight = 1f;
/// <summary>
/// On custom play, triggers a blend on the target blender, overriding its settings if needed
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
if (TargetAutoBlend == null)
{
Debug.LogWarning(Owner.name + " : this MMFeedbackGlobalPPVolumeAutoBlend needs a TargetAutoBlend, please set one in its inspector.");
return;
}
if (Mode == Modes.Default)
{
if (BlendAction == Actions.Blend)
{
TargetAutoBlend.Blend();
return;
}
if (BlendAction == Actions.BlendBack)
{
TargetAutoBlend.BlendBack();
return;
}
}
else
{
TargetAutoBlend.BlendDuration = FeedbackDuration;
TargetAutoBlend.Curve = BlendCurve;
TargetAutoBlend.InitialWeight = InitialWeight;
TargetAutoBlend.FinalWeight = FinalWeight;
TargetAutoBlend.Blend();
}
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
if (TargetAutoBlend != null)
{
TargetAutoBlend.StopBlending();
}
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
TargetAutoBlend.RestoreInitialValues();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 47f1225adf998da428534e361e152700
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,116 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP lens distortion intensity over time.
/// It requires you have in your scene an object with a Volume
/// with Lens Distortion active, and a MMLensDistortionShaker_URP component.
/// </summary>
[AddComponentMenu("")]
#if MM_URP
[FeedbackPath("PostProcess/Lens Distortion URP")]
#endif
[FeedbackHelp("This feedback allows you to control URP lens distortion intensity over time. " +
"It requires you have in your scene an object with a Volume " +
"with Lens Distortion active, and a MMLensDistortionShaker_URP component.")]
public class MMF_LensDistortion_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Lens Distortion", true, 22)]
/// the duration of the shake in seconds
[Tooltip("the duration of the shake in seconds")]
public float Duration = 0.8f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[MMFInspectorGroup("Intensity", true, 23)]
/// whether or not to add to the initial intensity value
[Tooltip("whether or not to add to the initial intensity value")]
public bool RelativeIntensity = false;
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0),
new Keyframe(0.2f, 1),
new Keyframe(0.25f, -1),
new Keyframe(0.35f, 0.7f),
new Keyframe(0.4f, -0.7f),
new Keyframe(0.6f, 0.3f),
new Keyframe(0.65f, -0.3f),
new Keyframe(0.8f, 0.1f),
new Keyframe(0.85f, -0.1f),
new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-1f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-1f, 1f)]
public float RemapIntensityOne = 0.5f;
/// <summary>
/// Triggers a lens distortion shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMLensDistortionShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMLensDistortionShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop:true, channelData: ChannelData);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMLensDistortionShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, restore:true, channelData: ChannelData);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 43306c87c2558ad4c960d73c419e65aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,107 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP motion blur intensity over time.
/// It requires you have in your scene an object with a Volume
/// with MotionBlur active, and a MMMotionBlurShaker_URP component.
/// </summary>
[AddComponentMenu("")]
#if MM_URP
[FeedbackPath("PostProcess/Motion Blur URP")]
#endif
[FeedbackHelp("This feedback allows you to control motion blur intensity over time. " +
"It requires you have in your scene an object with a Volume " +
"with MotionBlur active, and a MMMotionBlurShaker_URP component.")]
public class MMF_MotionBlur_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Motion Blur", true, 25)]
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[MMFInspectorGroup("Intensity", true, 24)]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to which to remap the curve's zero to
[Tooltip("the value to which to remap the curve's zero to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to which to remap the curve's one to
[Tooltip("the value to which to remap the curve's one to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1.0f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = false;
/// <summary>
/// Triggers a motion blur shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMMotionBlurShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMMotionBlurShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop: true, channelData: ChannelData);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMMotionBlurShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, restore: true, channelData: ChannelData);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 51cd42785d86b984f857efaa3a7e0f28
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,106 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control Panini Projection distance and crop to fit over time.
/// It requires you have in your scene an object with a Volume with Bloom active, and a MMPaniniProjectionShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control Panini Projection distance and crop to fit over time. " +
"It requires you have in your scene an object with a Volume " +
"with PaniniProjection active, and a MMPaniniProjectionShaker_URP component.")]
#if MM_URP
[FeedbackPath("PostProcess/Panini Projection URP")]
#endif
public class MMF_PaniniProjection_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Panini Projection", true, 28)]
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[MMFInspectorGroup("Distance", true, 27)]
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeDistance = false;
/// the curve used to animate the distance value on
[Tooltip("the curve used to animate the distance value on")]
public AnimationCurve ShakeDistance = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 1f)]
public float RemapDistanceZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 1f)]
public float RemapDistanceOne = 1f;
/// <summary>
/// Triggers a bloom shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero, RemapDistanceOne, RelativeDistance, intensityMultiplier, ChannelData,
ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero, RemapDistanceOne, RelativeDistance, channelData: ChannelData, stop: true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero, RemapDistanceOne, RelativeDistance, channelData: ChannelData, restore: true);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bd752e51b75d9404f8567b2de4478a17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,108 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control URP vignette intensity over time.
/// It requires you have in your scene an object with a Volume
/// with Vignette active, and a MMVignetteShaker_URP component.
/// </summary>
[AddComponentMenu("")]
#if MM_URP
[FeedbackPath("PostProcess/Vignette URP")]
#endif
[FeedbackHelp("This feedback allows you to control vignette intensity over time. " +
"It requires you have in your scene an object with a Volume " +
"with Vignette active, and a MMVignetteShaker_URP component.")]
public class MMF_Vignette_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("Vignette", true, 28)]
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float Duration = 0.2f;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[MMFInspectorGroup("Intensity", true, 29)]
/// the curve to animate the intensity on
[Tooltip("the curve to animate the intensity on")]
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's zero to
[Tooltip("the value to remap the curve's zero to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's one to
[Tooltip("the value to remap the curve's one to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1.0f;
/// whether or not to add to the initial intensity
[Tooltip("whether or not to add to the initial intensity")]
public bool RelativeIntensity = false;
/// <summary>
/// Triggers a vignette shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
base.CustomStopFeedback(position, feedbacksIntensity);
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop: true, channelData: ChannelData);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, restore: true, channelData: ChannelData);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e4184b673db0e27469895c376f79e78c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,124 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control white balance temperature and tint over time.
/// It requires you have in your scene an object with a Volume with White Balance active, and a MMWhiteBalanceShaker_URP component.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback allows you to control white balance temperature and tint over time. " +
"It requires you have in your scene an object with a Volume " +
"with WhiteBalance active, and a MMWhiteBalanceShaker_URP component.")]
#if MM_URP
[FeedbackPath("PostProcess/White Balance URP")]
#endif
public class MMF_WhiteBalance_URP : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
#endif
/// the duration of this feedback is the duration of the shake
public override float FeedbackDuration { get { return ApplyTimeMultiplier(ShakeDuration); } set { ShakeDuration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
[MMFInspectorGroup("White Balance", true, 29)]
/// the duration of the shake, in seconds
[Tooltip("the duration of the shake, in seconds")]
public float ShakeDuration = 1f;
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeValues = true;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
public bool ResetShakerValuesAfterShake = true;
/// whether or not to reset the target's values after shake
[Tooltip("whether or not to reset the target's values after shake")]
public bool ResetTargetValuesAfterShake = true;
[MMFInspectorGroup("Temperature", true, 29)]
/// the curve used to animate the temperature value on
[Tooltip("the curve used to animate the temperature value on")]
public AnimationCurve ShakeTemperature = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapTemperatureZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapTemperatureOne = 100f;
[MMFInspectorGroup("Tint", true, 29)]
/// the curve used to animate the tint value on
[Tooltip("the curve used to animate the tint value on")]
public AnimationCurve ShakeTint = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapTintZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapTintOne = 100f;
/// <summary>
/// Triggers a white balance shake
/// </summary>
/// <param name="position"></param>
/// <param name="attenuation"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMWhiteBalanceShakeEvent_URP.Trigger(ShakeTemperature, FeedbackDuration, RemapTemperatureZero, RemapTemperatureOne,
ShakeTint, RemapTintZero, RemapTintOne, RelativeValues, intensityMultiplier,
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
}
/// <summary>
/// On stop we stop our transition
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMWhiteBalanceShakeEvent_URP.Trigger(ShakeTemperature, FeedbackDuration, RemapTemperatureZero, RemapTemperatureOne,
ShakeTint, RemapTintZero, RemapTintOne, RelativeValues, stop: true, channelData: ChannelData);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMWhiteBalanceShakeEvent_URP.Trigger(ShakeTemperature, FeedbackDuration, RemapTemperatureZero, RemapTemperatureOne,
ShakeTint, RemapTintZero, RemapTintOne, RelativeValues, restore: true, channelData: ChannelData);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3ea237bea7ee0284eb3c367668540cdc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ce78b4097230f9d40ab184d4a00c27aa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,195 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Use this class to have a global PP volume auto blend its weight on cue, between a start and end values
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMGlobalPostProcessingVolumeAutoBlend_URP")]
public class MMGlobalPostProcessingVolumeAutoBlend_URP : MonoBehaviour
{
/// the possible timescales this blend can operate on
public enum TimeScales { Scaled, Unscaled }
/// the possible blend trigger modes
public enum BlendTriggerModes { OnEnable, Script }
[Header("Blend")]
/// the trigger mode for this MMGlobalPostProcessingVolumeAutoBlend
/// Start : will play automatically on enable
public BlendTriggerModes BlendTriggerMode = BlendTriggerModes.OnEnable;
/// the duration of the blend (in seconds)
public float BlendDuration = 1f;
/// the curve to use to blend
public AnimationCurve Curve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1f));
[Header("Weight")]
/// the weight at the start of the blend
[Range(0f, 1f)]
public float InitialWeight = 0f;
/// the desired weight at the end of the blend
[Range(0f, 1f)]
public float FinalWeight = 1f;
[Header("Behaviour")]
/// the timescale to operate on
public TimeScales TimeScale = TimeScales.Unscaled;
/// whether or not the associated volume should be disabled at 0
public bool DisableVolumeOnZeroWeight = true;
/// whether or not this blender should disable itself at 0
public bool DisableSelfAfterEnd = true;
/// whether or not this blender can be interrupted
public bool Interruptable = true;
/// whether or not this blender should pick the current value as its starting point
public bool StartFromCurrentValue = true;
[Header("Tests")]
/// test blend button
[MMFInspectorButton("Blend")]
public bool TestBlend;
/// test blend back button
[MMFInspectorButton("BlendBack")]
public bool TestBlendBackwards;
/// <summary>
/// Returns the correct timescale based on the chosen settings
/// </summary>
/// <returns></returns>
protected float GetTime()
{
return (TimeScale == TimeScales.Unscaled) ? Time.unscaledTime : Time.time;
}
protected float _initial;
protected float _destination;
protected float _startTime;
protected bool _blending = false;
#if MM_URP
protected Volume _volume;
/// <summary>
/// On Awake we store our volume
/// </summary>
protected virtual void Awake()
{
_volume = this.gameObject.GetComponent<Volume>();
_volume.weight = InitialWeight;
}
#endif
/// <summary>
/// On start we start blending if needed
/// </summary>
protected virtual void OnEnable()
{
if ((BlendTriggerMode == BlendTriggerModes.OnEnable) && !_blending)
{
Blend();
}
}
/// <summary>
/// Blends the volume's weight from the initial value to the final one
/// </summary>
public virtual void Blend()
{
#if MM_URP
if (_blending && !Interruptable)
{
return;
}
_initial = StartFromCurrentValue ? _volume.weight : InitialWeight;
_destination = FinalWeight;
StartBlending();
#endif
}
/// <summary>
/// Blends the volume's weight from the final value to the initial one
/// </summary>
public virtual void BlendBack()
{
#if MM_URP
if (_blending && !Interruptable)
{
return;
}
_initial = StartFromCurrentValue ? _volume.weight : FinalWeight;
_destination = InitialWeight;
StartBlending();
#endif
}
/// <summary>
/// Internal method used to start blending
/// </summary>
protected virtual void StartBlending()
{
#if MM_URP
_startTime = GetTime();
_blending = true;
this.enabled = true;
if (DisableVolumeOnZeroWeight)
{
_volume.enabled = true;
}
#endif
}
/// <summary>
/// Stops any blending that may be in progress
/// </summary>
public virtual void StopBlending()
{
_blending = false;
}
/// <summary>
/// On update, processes the blend if needed
/// </summary>
protected virtual void Update()
{
if (!_blending)
{
return;
}
#if MM_URP
float timeElapsed = (GetTime() - _startTime);
if (timeElapsed < BlendDuration)
{
float remapped = MMFeedbacksHelpers.Remap(timeElapsed, 0f, BlendDuration, 0f, 1f);
_volume.weight = Mathf.LerpUnclamped(_initial, _destination, Curve.Evaluate(remapped));
}
else
{
// after end is reached
_volume.weight = _destination;
_blending = false;
if (DisableVolumeOnZeroWeight && (_volume.weight == 0f))
{
_volume.enabled = false;
}
if (DisableSelfAfterEnd)
{
this.enabled = false;
}
}
#endif
}
public virtual void RestoreInitialValues()
{
#if MM_URP
_volume.weight = _initial;
#endif
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 863e22bb4bee3884e8c0e9d1823db321
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
{
"name": "MoreMountains.Feedbacks.URP",
"references": [
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
"GUID:8087d854c1f812e4b9a74437dfc524e0",
"GUID:4a1cb1490dc4df8409b2580d6b44e75e"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.unity.render-pipelines.universal",
"expression": "1.0.0",
"define": "MM_URP"
}
],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f81e926ef5b1a3e4fad4bc10bb9e5633
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c0554a55c58ecf44192e8e881ceac4cb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,64 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This class will set the URP depth of field to focus on the set of targets specified in its inspector.
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMAutoFocus_URP")]
public class MMAutoFocus_URP : MonoBehaviour
{
[Header("Bindings")]
/// the position of the camera
[Tooltip("the position of the camera")]
public Transform CameraTransform;
/// a list of all possible targets
[Tooltip("a list of all possible targets")]
public Transform[] FocusTargets;
[Header("Setup")]
/// the current target of this auto focus
[Tooltip("the current target of this auto focus")]
public float FocusTargetID;
[Header("Desired Aperture")]
/// the aperture to work with
[Tooltip("the aperture to work with")]
[Range(0.1f, 20f)]
public float Aperture = 0.1f;
#if MM_URP
protected Volume _volume;
protected VolumeProfile _profile;
protected DepthOfField _depthOfField;
/// <summary>
/// On Start, stores volume, profile and DoF
/// </summary>
void Start()
{
_volume = GetComponent<Volume>();
_profile = _volume.profile;
_profile.TryGet<DepthOfField>(out _depthOfField);
}
/// <summary>
/// On update we set our focus distance and aperture
/// </summary>
void Update()
{
float distance = Vector3.Distance(CameraTransform.position, FocusTargets[Mathf.FloorToInt(FocusTargetID)].position);
_depthOfField.focusDistance.Override(distance);
_depthOfField.aperture.Override(Aperture);
}
#endif
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 97e17950a649fa84189ca3446539280b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,221 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP bloom post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMBloomShaker_URP")]
public class MMBloomShaker_URP : MMShaker
{
/// whether or not to add to the initial value
public bool RelativeValues = true;
[MMInspectorGroup("Bloom Intensity", true, 51)]
/// the curve used to animate the intensity value on
[Tooltip("the curve used to animate the intensity value on")]
public AnimationCurve ShakeIntensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapIntensityOne = 1f;
[MMInspectorGroup("Bloom Threshold", true, 52)]
/// the curve used to animate the threshold value on
[Tooltip("the curve used to animate the threshold value on")]
public AnimationCurve ShakeThreshold = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapThresholdZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapThresholdOne = 0f;
#if MM_URP
protected Volume _volume;
protected Bloom _bloom;
protected float _initialIntensity;
protected float _initialThreshold;
protected float _originalShakeDuration;
protected bool _originalRelativeIntensity;
protected AnimationCurve _originalShakeIntensity;
protected float _originalRemapIntensityZero;
protected float _originalRemapIntensityOne;
protected AnimationCurve _originalShakeThreshold;
protected float _originalRemapThresholdZero;
protected float _originalRemapThresholdOne;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _bloom);
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newIntensity = ShakeFloat(ShakeIntensity, RemapIntensityZero, RemapIntensityOne, RelativeValues, _initialIntensity);
_bloom.intensity.Override(newIntensity);
float newThreshold = ShakeFloat(ShakeThreshold, RemapThresholdZero, RemapThresholdOne, RelativeValues, _initialThreshold);
_bloom.threshold.Override(newThreshold);
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialIntensity = _bloom.intensity.value;
_initialThreshold = _bloom.threshold.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="intensity"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeIntensity"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnBloomShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax,
AnimationCurve threshold, float remapThresholdMin, float remapThresholdMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalShakeIntensity = ShakeIntensity;
_originalRemapIntensityZero = RemapIntensityZero;
_originalRemapIntensityOne = RemapIntensityOne;
_originalRelativeIntensity = RelativeValues;
_originalShakeThreshold = ShakeThreshold;
_originalRemapThresholdZero = RemapThresholdZero;
_originalRemapThresholdOne = RemapThresholdOne;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * attenuation;
RemapIntensityOne = remapMax * attenuation;
RelativeValues = relativeIntensity;
ShakeThreshold = threshold;
RemapThresholdZero = remapThresholdMin;
RemapThresholdOne = remapThresholdMax;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_bloom.intensity.Override(_initialIntensity);
_bloom.threshold.Override(_initialThreshold);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
ShakeIntensity = _originalShakeIntensity;
RemapIntensityZero = _originalRemapIntensityZero;
RemapIntensityOne = _originalRemapIntensityOne;
RelativeValues = _originalRelativeIntensity;
ShakeThreshold = _originalShakeThreshold;
RemapThresholdZero = _originalRemapThresholdZero;
RemapThresholdOne = _originalRemapThresholdOne;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMBloomShakeEvent_URP.Register(OnBloomShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMBloomShakeEvent_URP.Unregister(OnBloomShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMBloomShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve intensity, float duration, float remapMin, float remapMax,
AnimationCurve threshold, float remapThresholdMin, float remapThresholdMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve intensity, float duration, float remapMin, float remapMax,
AnimationCurve threshold, float remapThresholdMin, float remapThresholdMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(intensity, duration, remapMin, remapMax, threshold, remapThresholdMin, remapThresholdMax, relativeIntensity,
attenuation, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 485e02e02c638cf4b9ca8344fd6213a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,276 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP color adjustments post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMChannelMixerShaker_URP")]
public class MMChannelMixerShaker_URP : MMShaker
{
/// whether or not to add to the initial value
public bool RelativeValues = true;
[MMInspectorGroup("Red", true, 43)]
/// the curve used to animate the red value on
[Tooltip("the curve used to animate the red value on")]
public AnimationCurve ShakeRed = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-200f, 200f)]
public float RemapRedZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-200f, 200f)]
public float RemapRedOne = 200f;
[MMInspectorGroup("Green", true, 44)]
/// the curve used to animate the green value on
[Tooltip("the curve used to animate the green value on")]
public AnimationCurve ShakeGreen = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-200f, 200f)]
public float RemapGreenZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-200f, 200f)]
public float RemapGreenOne = 200f;
[MMInspectorGroup("Blue", true, 45)]
/// the curve used to animate the blue value on
[Tooltip("the curve used to animate the blue value on")]
public AnimationCurve ShakeBlue = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-200f, 200f)]
public float RemapBlueZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-200f, 200f)]
public float RemapBlueOne = 200f;
#if MM_URP
protected Volume _volume;
protected ChannelMixer _channelMixer;
protected float _initialRed;
protected float _initialGreen;
protected float _initialBlue;
protected float _initialContrast;
protected Color _initialColorFilterColor;
protected float _originalShakeDuration;
protected bool _originalRelativeValues;
protected AnimationCurve _originalShakeRed;
protected float _originalRemapRedZero;
protected float _originalRemapRedOne;
protected AnimationCurve _originalShakeGreen;
protected float _originalRemapGreenZero;
protected float _originalRemapGreenOne;
protected AnimationCurve _originalShakeBlue;
protected float _originalRemapBlueZero;
protected float _originalRemapBlueOne;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _channelMixer);
}
/// <summary>
/// When that shaker gets added, we initialize its shake duration
/// </summary>
protected virtual void Reset()
{
ShakeDuration = 0.8f;
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newRed = ShakeFloat(ShakeRed, RemapRedZero, RemapRedOne, RelativeValues, _initialRed);
_channelMixer.redOutRedIn.Override(newRed);
float newGreen = ShakeFloat(ShakeGreen, RemapGreenZero, RemapGreenOne, RelativeValues, _initialGreen);
_channelMixer.greenOutGreenIn.Override(newGreen);
float newBlue = ShakeFloat(ShakeBlue, RemapBlueZero, RemapBlueOne, RelativeValues, _initialBlue);
_channelMixer.blueOutBlueIn.Override(newBlue);
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialRed = _channelMixer.redOutRedIn.value;
_initialGreen = _channelMixer.greenOutGreenIn.value;
_initialBlue = _channelMixer.blueOutBlueIn.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="intensity"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeIntensity"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnMMChannelMixerShakeEvent(AnimationCurve shakeRed, float remapRedZero, float remapRedOne,
AnimationCurve shakeGreen, float remapGreenZero, float remapGreenOne,
AnimationCurve shakeBlue, float remapBlueZero, float remapBlueOne,
float duration, bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalRelativeValues = RelativeValues;
_originalShakeRed = ShakeRed;
_originalRemapRedZero = RemapRedZero;
_originalRemapRedOne = RemapRedOne;
_originalShakeGreen = ShakeGreen;
_originalRemapGreenZero = RemapGreenZero;
_originalRemapGreenOne = RemapGreenOne;
_originalShakeBlue = ShakeBlue;
_originalRemapBlueZero = RemapBlueZero;
_originalRemapBlueOne = RemapBlueOne;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
RelativeValues = relativeValues;
ShakeRed = shakeRed;
RemapRedZero = remapRedZero;
RemapRedOne = remapRedOne;
ShakeGreen = shakeGreen;
RemapGreenZero = remapGreenZero;
RemapGreenOne = remapGreenOne;
ShakeBlue = shakeBlue;
RemapBlueZero = remapBlueZero;
RemapBlueOne = remapBlueOne;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_channelMixer.redOutRedIn.Override(_initialRed);
_channelMixer.greenOutGreenIn.Override(_initialGreen);
_channelMixer.blueOutBlueIn.Override(_initialBlue);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
RelativeValues = _originalRelativeValues;
ShakeRed = _originalShakeRed;
RemapRedZero = _originalRemapRedZero;
RemapRedOne = _originalRemapRedOne;
ShakeGreen = _originalShakeGreen;
RemapGreenZero = _originalRemapGreenZero;
RemapGreenOne = _originalRemapGreenOne;
ShakeBlue = _originalShakeBlue;
RemapBlueZero = _originalRemapBlueZero;
RemapBlueOne = _originalRemapBlueOne;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMChannelMixerShakeEvent_URP.Register(OnMMChannelMixerShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMChannelMixerShakeEvent_URP.Unregister(OnMMChannelMixerShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMChannelMixerShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(
AnimationCurve shakeRed, float remapRedZero, float remapRedOne,
AnimationCurve shakeGreen, float remapGreenZero, float remapGreenOne,
AnimationCurve shakeBlue, float remapBlueZero, float remapBlueOne,
float duration, bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(
AnimationCurve shakeRed, float remapRedZero, float remapRedOne,
AnimationCurve shakeGreen, float remapGreenZero, float remapGreenOne,
AnimationCurve shakeBlue, float remapBlueZero, float remapBlueOne,
float duration, bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(shakeRed, remapRedZero, remapRedOne,
shakeGreen, remapGreenZero, remapGreenOne,
shakeBlue, remapBlueZero, remapBlueOne,
duration, relativeValues, attenuation, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e79061224d0604740b66d87c50047581
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,190 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP chromatic aberration post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMChromaticAberrationShaker_URP")]
public class MMChromaticAberrationShaker_URP : MMShaker
{
[MMInspectorGroup("Chromatic Aberration Intensity", true, 45)]
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeIntensity = false;
/// the curve used to animate the intensity value on
[Tooltip("the curve used to animate the intensity value on")]
public AnimationCurve ShakeIntensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1f;
#if MM_URP
protected Volume _volume;
protected ChromaticAberration _chromaticAberration;
protected float _initialIntensity;
protected float _originalShakeDuration;
protected AnimationCurve _originalShakeIntensity;
protected float _originalRemapIntensityZero;
protected float _originalRemapIntensityOne;
protected bool _originalRelativeIntensity;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _chromaticAberration);
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newValue = ShakeFloat(ShakeIntensity, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, _initialIntensity);
_chromaticAberration.intensity.Override(newValue);
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialIntensity = _chromaticAberration.intensity.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="intensity"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeIntensity"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnMMChromaticAberrationShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalShakeIntensity = ShakeIntensity;
_originalRemapIntensityZero = RemapIntensityZero;
_originalRemapIntensityOne = RemapIntensityOne;
_originalRelativeIntensity = RelativeIntensity;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * attenuation;
RemapIntensityOne = remapMax * attenuation;
RelativeIntensity = relativeIntensity;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_chromaticAberration.intensity.Override(_initialIntensity);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
ShakeIntensity = _originalShakeIntensity;
RemapIntensityZero = _originalRemapIntensityZero;
RemapIntensityOne = _originalRemapIntensityOne;
RelativeIntensity = _originalRelativeIntensity;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMChromaticAberrationShakeEvent_URP.Register(OnMMChromaticAberrationShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMChromaticAberrationShakeEvent_URP.Unregister(OnMMChromaticAberrationShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMChromaticAberrationShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(intensity, duration, remapMin, remapMax, relativeIntensity, attenuation, channelData,
resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d01154bce0123949a8800d85a063092
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,358 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP color adjustments post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMColorAdjustmentsShaker_URP")]
public class MMColorAdjustmentsShaker_URP : MMShaker
{
/// whether or not to add to the initial value
public bool RelativeValues = true;
[MMInspectorGroup("Post Exposure", true, 43)]
/// the curve used to animate the focus distance value on
[Tooltip("the curve used to animate the focus distance value on")]
public AnimationCurve ShakePostExposure = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapPostExposureZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapPostExposureOne = 1f;
[MMInspectorGroup("Hue Shift", true, 44)]
/// the curve used to animate the aperture value on
[Tooltip("the curve used to animate the aperture value on")]
public AnimationCurve ShakeHueShift = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Range(-180f, 180f)]
[Tooltip("the value to remap the curve's 0 to")]
public float RemapHueShiftZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-180f, 180f)]
public float RemapHueShiftOne = 180f;
[MMInspectorGroup("Saturation", true, 45)]
/// the curve used to animate the focal length value on
[Tooltip("the curve used to animate the focal length value on")]
public AnimationCurve ShakeSaturation = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapSaturationZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapSaturationOne = 100f;
[MMInspectorGroup("Contrast", true, 47)]
/// the curve used to animate the focal length value on
[Tooltip("the curve used to animate the focal length value on")]
public AnimationCurve ShakeContrast = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapContrastZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapContrastOne = 100f;
public enum ColorFilterModes { None, Gradient, Interpolate }
[MMInspectorGroup("Color Filter", true, 48)]
/// the color filter mode to work with (none, over a gradient, or interpolate to a destination color
[Tooltip("the color filter mode to work with (none, over a gradient, or interpolate to a destination color")]
public ColorFilterModes ColorFilterMode = ColorFilterModes.None;
/// the gradient over which to modify the color filter
[Tooltip("the gradient over which to modify the color filter")]
[MMFEnumCondition("ColorFilterMode", (int)ColorFilterModes.Gradient)]
[GradientUsage(true)]
public Gradient ColorFilterGradient;
/// the destination color to match when in Interpolate mode
[Tooltip("the destination color to match when in Interpolate mode")]
[MMFEnumCondition("ColorFilterMode", (int) ColorFilterModes.Interpolate)]
public Color ColorFilterDestination = Color.yellow;
/// the curve over which to interpolate the color filter
[Tooltip("the curve over which to interpolate the color filter")]
[MMFEnumCondition("ColorFilterMode", (int) ColorFilterModes.Interpolate)]
public AnimationCurve ColorFilterCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
#if MM_URP
protected Volume _volume;
protected ColorAdjustments _colorAdjustments;
protected float _initialPostExposure;
protected float _initialHueShift;
protected float _initialSaturation;
protected float _initialContrast;
protected Color _initialColorFilterColor;
protected float _originalShakeDuration;
protected bool _originalRelativeValues;
protected AnimationCurve _originalShakePostExposure;
protected float _originalRemapPostExposureZero;
protected float _originalRemapPostExposureOne;
protected AnimationCurve _originalShakeHueShift;
protected float _originalRemapHueShiftZero;
protected float _originalRemapHueShiftOne;
protected AnimationCurve _originalShakeSaturation;
protected float _originalRemapSaturationZero;
protected float _originalRemapSaturationOne;
protected AnimationCurve _originalShakeContrast;
protected float _originalRemapContrastZero;
protected float _originalRemapContrastOne;
protected ColorFilterModes _originalColorFilterMode;
protected Gradient _originalColorFilterGradient;
protected Color _originalColorFilterDestination;
protected AnimationCurve _originalColorFilterCurve;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _colorAdjustments);
}
/// <summary>
/// When that shaker gets added, we initialize its shake duration
/// </summary>
protected virtual void Reset()
{
ShakeDuration = 0.8f;
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newPostExposure = ShakeFloat(ShakePostExposure, RemapPostExposureZero, RemapPostExposureOne, RelativeValues, _initialPostExposure);
_colorAdjustments.postExposure.Override(newPostExposure);
float newHueShift = ShakeFloat(ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne, RelativeValues, _initialHueShift);
_colorAdjustments.hueShift.Override(newHueShift);
float newSaturation = ShakeFloat(ShakeSaturation, RemapSaturationZero, RemapSaturationOne, RelativeValues, _initialSaturation);
_colorAdjustments.saturation.Override(newSaturation);
float newContrast = ShakeFloat(ShakeContrast, RemapContrastZero, RemapContrastOne, RelativeValues, _initialContrast);
_colorAdjustments.contrast.Override(newContrast);
_remappedTimeSinceStart = MMFeedbacksHelpers.Remap(Time.time - _shakeStartedTimestamp, 0f, ShakeDuration, 0f, 1f);
if (ColorFilterMode == ColorFilterModes.Gradient)
{
_colorAdjustments.colorFilter.Override(ColorFilterGradient.Evaluate(_remappedTimeSinceStart));
}
else if (ColorFilterMode == ColorFilterModes.Interpolate)
{
float factor = ColorFilterCurve.Evaluate(_remappedTimeSinceStart);
_colorAdjustments.colorFilter.Override(Color.LerpUnclamped(_initialColorFilterColor, ColorFilterDestination, factor));
}
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialPostExposure = _colorAdjustments.postExposure.value;
_initialHueShift = _colorAdjustments.hueShift.value;
_initialSaturation = _colorAdjustments.saturation.value;
_initialContrast = _colorAdjustments.contrast.value;
_initialColorFilterColor = _colorAdjustments.colorFilter.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="intensity"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeIntensity"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnMMColorGradingShakeEvent(AnimationCurve shakePostExposure, float remapPostExposureZero, float remapPostExposureOne,
AnimationCurve shakeHueShift, float remapHueShiftZero, float remapHueShiftOne,
AnimationCurve shakeSaturation, float remapSaturationZero, float remapSaturationOne,
AnimationCurve shakeContrast, float remapContrastZero, float remapContrastOne,
ColorFilterModes colorFilterMode, Gradient colorFilterGradient, Color colorFilterDestination,AnimationCurve colorFilterCurve,
float duration, bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalRelativeValues = RelativeValues;
_originalShakePostExposure = ShakePostExposure;
_originalRemapPostExposureZero = RemapPostExposureZero;
_originalRemapPostExposureOne = RemapPostExposureOne;
_originalShakeHueShift = ShakeHueShift;
_originalRemapHueShiftZero = RemapHueShiftZero;
_originalRemapHueShiftOne = RemapHueShiftOne;
_originalShakeSaturation = ShakeSaturation;
_originalRemapSaturationZero = RemapSaturationZero;
_originalRemapSaturationOne = RemapSaturationOne;
_originalShakeContrast = ShakeContrast;
_originalRemapContrastZero = RemapContrastZero;
_originalRemapContrastOne = RemapContrastOne;
_originalColorFilterMode = ColorFilterMode;
_originalColorFilterGradient = ColorFilterGradient;
_originalColorFilterDestination = ColorFilterDestination;
_originalColorFilterCurve = ColorFilterCurve;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
RelativeValues = relativeValues;
ShakePostExposure = shakePostExposure;
RemapPostExposureZero = remapPostExposureZero;
RemapPostExposureOne = remapPostExposureOne;
ShakeHueShift = shakeHueShift;
RemapHueShiftZero = remapHueShiftZero;
RemapHueShiftOne = remapHueShiftOne;
ShakeSaturation = shakeSaturation;
RemapSaturationZero = remapSaturationZero;
RemapSaturationOne = remapSaturationOne;
ShakeContrast = shakeContrast;
RemapContrastZero = remapContrastZero;
RemapContrastOne = remapContrastOne;
ColorFilterMode = colorFilterMode;
ColorFilterGradient = colorFilterGradient;
ColorFilterDestination = colorFilterDestination;
ColorFilterCurve = colorFilterCurve;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_colorAdjustments.postExposure.Override(_initialPostExposure);
_colorAdjustments.hueShift.Override(_initialHueShift);
_colorAdjustments.saturation.Override(_initialSaturation);
_colorAdjustments.contrast.Override(_initialContrast);
_colorAdjustments.colorFilter.Override(_initialColorFilterColor);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
RelativeValues = _originalRelativeValues;
ShakePostExposure = _originalShakePostExposure;
RemapPostExposureZero = _originalRemapPostExposureZero;
RemapPostExposureOne = _originalRemapPostExposureOne;
ShakeHueShift = _originalShakeHueShift;
RemapHueShiftZero = _originalRemapHueShiftZero;
RemapHueShiftOne = _originalRemapHueShiftOne;
ShakeSaturation = _originalShakeSaturation;
RemapSaturationZero = _originalRemapSaturationZero;
RemapSaturationOne = _originalRemapSaturationOne;
ShakeContrast = _originalShakeContrast;
RemapContrastZero = _originalRemapContrastZero;
RemapContrastOne = _originalRemapContrastOne;
ColorFilterMode = _originalColorFilterMode;
ColorFilterGradient = _originalColorFilterGradient;
ColorFilterDestination = _originalColorFilterDestination;
ColorFilterCurve = _originalColorFilterCurve;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMColorAdjustmentsShakeEvent_URP.Register(OnMMColorGradingShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMColorAdjustmentsShakeEvent_URP.Unregister(OnMMColorGradingShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMColorAdjustmentsShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve shakePostExposure, float remapPostExposureZero, float remapPostExposureOne,
AnimationCurve shakeHueShift, float remapHueShiftZero, float remapHueShiftOne,
AnimationCurve shakeSaturation, float remapSaturationZero, float remapSaturationOne,
AnimationCurve shakeContrast, float remapContrastZero, float remapContrastOne,
MMColorAdjustmentsShaker_URP.ColorFilterModes colorFilterMode, Gradient colorFilterGradient, Color colorFilterDestination,AnimationCurve colorFilterCurve,
float duration, bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve shakePostExposure, float remapPostExposureZero, float remapPostExposureOne,
AnimationCurve shakeHueShift, float remapHueShiftZero, float remapHueShiftOne,
AnimationCurve shakeSaturation, float remapSaturationZero, float remapSaturationOne,
AnimationCurve shakeContrast, float remapContrastZero, float remapContrastOne,
MMColorAdjustmentsShaker_URP.ColorFilterModes colorFilterMode, Gradient colorFilterGradient, Color colorFilterDestination,AnimationCurve colorFilterCurve,
float duration, bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(shakePostExposure, remapPostExposureZero, remapPostExposureOne,
shakeHueShift, remapHueShiftZero, remapHueShiftOne,
shakeSaturation, remapSaturationZero, remapSaturationOne,
shakeContrast, remapContrastZero, remapContrastOne,
colorFilterMode, colorFilterGradient, colorFilterDestination, colorFilterCurve,
duration, relativeValues, attenuation, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 71d1f877a9ca4ed48963fe747f743dfc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,269 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP depth of field post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMDepthOfFieldShaker_URP")]
public class MMDepthOfFieldShaker_URP : MMShaker
{
/// whether or not to add to the initial value
public bool RelativeValues = true;
[MMInspectorGroup("Focus Distance", true, 51)]
/// the curve used to animate the focus distance value on
[Tooltip("the curve used to animate the focus distance value on")]
public AnimationCurve ShakeFocusDistance = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
public float RemapFocusDistanceZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapFocusDistanceOne = 3f;
[MMInspectorGroup("Aperture", true, 52)]
/// the curve used to animate the aperture value on
[Tooltip("the curve used to animate the aperture value on")]
public AnimationCurve ShakeAperture = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Range(0.1f, 32f)]
[Tooltip("the value to remap the curve's 0 to")]
public float RemapApertureZero = 0f;
/// the value to remap the curve's 1 to
[Range(0.1f, 32f)]
[Tooltip("the value to remap the curve's 1 to")]
public float RemapApertureOne = 0f;
[MMInspectorGroup("Focal Length", true, 53)]
/// the curve used to animate the focal length value on
[Tooltip("the curve used to animate the focal length value on")]
public AnimationCurve ShakeFocalLength = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 300f)]
public float RemapFocalLengthZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 300f)]
public float RemapFocalLengthOne = 0f;
#if MM_URP
protected Volume _volume;
protected DepthOfField _depthOfField;
protected float _initialFocusDistance;
protected float _initialAperture;
protected float _initialFocalLength;
protected float _originalShakeDuration;
protected bool _originalRelativeValues;
protected AnimationCurve _originalShakeFocusDistance;
protected float _originalRemapFocusDistanceZero;
protected float _originalRemapFocusDistanceOne;
protected AnimationCurve _originalShakeAperture;
protected float _originalRemapApertureZero;
protected float _originalRemapApertureOne;
protected AnimationCurve _originalShakeFocalLength;
protected float _originalRemapFocalLengthZero;
protected float _originalRemapFocalLengthOne;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _depthOfField);
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newFocusDistance = ShakeFloat(ShakeFocusDistance, RemapFocusDistanceZero, RemapFocusDistanceOne, RelativeValues, _initialFocusDistance);
_depthOfField.focusDistance.Override(newFocusDistance);
float newAperture = ShakeFloat(ShakeAperture, RemapApertureZero, RemapApertureOne, RelativeValues, _initialAperture);
_depthOfField.aperture.Override(newAperture);
float newFocalLength = ShakeFloat(ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne, RelativeValues, _initialFocalLength);
_depthOfField.focalLength.Override(newFocalLength);
}
/// <summary>
/// When that shaker gets added, we initialize its shake duration
/// </summary>
protected virtual void Reset()
{
ShakeDuration = 2f;
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialFocusDistance = _depthOfField.focusDistance.value;
_initialAperture = _depthOfField.aperture.value;
_initialFocalLength = _depthOfField.focalLength.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="intensity"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeIntensity"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnDepthOfFieldShakeEvent(AnimationCurve focusDistance, float duration, float remapFocusDistanceMin, float remapFocusDistanceMax,
AnimationCurve aperture, float remapApertureMin, float remapApertureMax,
AnimationCurve focalLength, float remapFocalLengthMin, float remapFocalLengthMax,
bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalRelativeValues = RelativeValues;
_originalShakeFocusDistance = ShakeFocusDistance;
_originalRemapFocusDistanceZero = RemapFocusDistanceZero;
_originalRemapFocusDistanceOne = RemapFocusDistanceOne;
_originalShakeAperture = ShakeAperture;
_originalRemapApertureZero = RemapApertureZero;
_originalRemapApertureOne = RemapApertureOne;
_originalShakeFocalLength = ShakeFocalLength;
_originalRemapFocalLengthZero = RemapFocalLengthZero;
_originalRemapFocalLengthOne = RemapFocalLengthOne;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
RelativeValues = relativeValues;
ShakeFocusDistance = focusDistance;
RemapFocusDistanceZero = remapFocusDistanceMin;
RemapFocusDistanceOne = remapFocusDistanceMax;
ShakeAperture = aperture;
RemapApertureZero = remapApertureMin;
RemapApertureOne = remapApertureMax;
ShakeFocalLength = focalLength;
RemapFocalLengthZero = remapFocalLengthMin;
RemapFocalLengthOne = remapFocalLengthMax;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_depthOfField.focusDistance.Override(_initialFocusDistance);
_depthOfField.aperture.Override(_initialAperture);
_depthOfField.focalLength.Override(_initialFocalLength);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
RelativeValues = _originalRelativeValues;
ShakeFocusDistance = _originalShakeFocusDistance;
RemapFocusDistanceZero = _originalRemapFocusDistanceZero;
RemapFocusDistanceOne = _originalRemapFocusDistanceOne;
ShakeAperture = _originalShakeAperture;
RemapApertureZero = _originalRemapApertureZero;
RemapApertureOne = _originalRemapApertureOne;
ShakeFocalLength = _originalShakeFocalLength;
RemapFocalLengthZero = _originalRemapFocalLengthZero;
RemapFocalLengthOne = _originalRemapFocalLengthOne;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMDepthOfFieldShakeEvent_URP.Register(OnDepthOfFieldShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMDepthOfFieldShakeEvent_URP.Unregister(OnDepthOfFieldShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMDepthOfFieldShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve focusDistance, float duration, float remapFocusDistanceMin, float remapFocusDistanceMax,
AnimationCurve aperture, float remapApertureMin, float remapApertureMax,
AnimationCurve focalLength, float remapFocalLengthMin, float remapFocalLengthMax,
bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve focusDistance, float duration, float remapFocusDistanceMin, float remapFocusDistanceMax,
AnimationCurve aperture, float remapApertureMin, float remapApertureMax,
AnimationCurve focalLength, float remapFocalLengthMin, float remapFocalLengthMax,
bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(focusDistance, duration, remapFocusDistanceMin, remapFocusDistanceMax,
aperture, remapApertureMin, remapApertureMax,
focalLength, remapFocalLengthMin, remapFocalLengthMax, relativeValues,
attenuation, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f39d038dce44a7428bbe3628ec512d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,192 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP FilmGrain post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMFilmGrainShaker_URP")]
public class MMFilmGrainShaker_URP : MMShaker
{
[MMInspectorGroup("Film Grain Intensity", true, 51)]
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeIntensity = false;
/// the curve used to animate the intensity value on
[Tooltip("the curve used to animate the intensity value on")]
public AnimationCurve ShakeIntensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1f;
#if MM_URP
protected Volume _volume;
protected FilmGrain _filmGrain;
protected float _initialIntensity;
protected float _originalShakeDuration;
protected AnimationCurve _originalShakeIntensity;
protected float _originalRemapIntensityZero;
protected float _originalRemapIntensityOne;
protected bool _originalRelativeIntensity;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _filmGrain);
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newValue = ShakeFloat(ShakeIntensity, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, _initialIntensity);
_filmGrain.intensity.Override(newValue);
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialIntensity = _filmGrain.intensity.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="intensity"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeIntensity"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnFilmGrainShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalShakeIntensity = ShakeIntensity;
_originalRemapIntensityZero = RemapIntensityZero;
_originalRemapIntensityOne = RemapIntensityOne;
_originalRelativeIntensity = RelativeIntensity;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * attenuation;
RemapIntensityOne = remapMax * attenuation;
RelativeIntensity = relativeIntensity;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_filmGrain.intensity.Override(_initialIntensity);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
ShakeIntensity = _originalShakeIntensity;
RemapIntensityZero = _originalRemapIntensityZero;
RemapIntensityOne = _originalRemapIntensityOne;
RelativeIntensity = _originalRelativeIntensity;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMFilmGrainShakeEvent_URP.Register(OnFilmGrainShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMFilmGrainShakeEvent_URP.Unregister(OnFilmGrainShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger FilmGrain shakes
/// </summary>
public struct MMFilmGrainShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(intensity, duration, remapMin, remapMax, relativeIntensity, attenuation, channelData,
resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c5efb216979c3fd489936ad2e22d7e94
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,209 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP lens distortion post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMLensDistortionShaker_URP")]
public class MMLensDistortionShaker_URP : MMShaker
{
[MMInspectorGroup("Lens Distortion Intensity", true, 51)]
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeIntensity = false;
/// the curve used to animate the intensity value on
[Tooltip("the curve used to animate the intensity value on")]
public AnimationCurve ShakeIntensity = new AnimationCurve(new Keyframe(0, 0),
new Keyframe(0.2f, 1),
new Keyframe(0.25f, -1),
new Keyframe(0.35f, 0.7f),
new Keyframe(0.4f, -0.7f),
new Keyframe(0.6f, 0.3f),
new Keyframe(0.65f, -0.3f),
new Keyframe(0.8f, 0.1f),
new Keyframe(0.85f, -0.1f),
new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapIntensityOne = 0.5f;
#if MM_URP
protected Volume _volume;
protected LensDistortion _lensDistortion;
protected float _initialIntensity;
protected float _originalShakeDuration;
protected AnimationCurve _originalShakeIntensity;
protected float _originalRemapIntensityZero;
protected float _originalRemapIntensityOne;
protected bool _originalRelativeIntensity;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _lensDistortion);
}
/// <summary>
/// When that shaker gets added, we initialize its shake duration
/// </summary>
protected virtual void Reset()
{
ShakeDuration = 0.8f;
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newValue = ShakeFloat(ShakeIntensity, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, _initialIntensity);
_lensDistortion.intensity.Override(newValue);
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialIntensity = _lensDistortion.intensity.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="intensity"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeIntensity"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnMMLensDistortionShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalShakeIntensity = ShakeIntensity;
_originalRemapIntensityZero = RemapIntensityZero;
_originalRemapIntensityOne = RemapIntensityOne;
_originalRelativeIntensity = RelativeIntensity;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * attenuation;
RemapIntensityOne = remapMax * attenuation;
RelativeIntensity = relativeIntensity;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_lensDistortion.intensity.Override(_initialIntensity);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
ShakeIntensity = _originalShakeIntensity;
RemapIntensityZero = _originalRemapIntensityZero;
RemapIntensityOne = _originalRemapIntensityOne;
RelativeIntensity = _originalRelativeIntensity;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMLensDistortionShakeEvent_URP.Register(OnMMLensDistortionShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMLensDistortionShakeEvent_URP.Unregister(OnMMLensDistortionShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMLensDistortionShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(intensity, duration, remapMin, remapMax, relativeIntensity, attenuation, channelData,
resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bbf0ffd851dbe2d4fb5d79335529e131
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,192 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP vignette post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMMotionBlurShaker_URP")]
public class MMMotionBlurShaker_URP : MMShaker
{
[MMInspectorGroup("Motion Blur Intensity", true, 61)]
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeIntensity = false;
/// the curve used to animate the intensity value on
[Tooltip("the curve used to animate the intensity value on")]
public AnimationCurve ShakeIntensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1f;
#if MM_URP
protected Volume _volume;
protected MotionBlur _motionBlur;
protected float _initialIntensity;
protected float _originalShakeDuration;
protected AnimationCurve _originalShakeIntensity;
protected float _originalRemapIntensityZero;
protected float _originalRemapIntensityOne;
protected bool _originalRelativeIntensity;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _motionBlur);
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newValue = ShakeFloat(ShakeIntensity, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, _initialIntensity);
_motionBlur.intensity.Override(newValue);
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialIntensity = _motionBlur.intensity.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="intensity"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeIntensity"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnMotionBlurShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalShakeIntensity = ShakeIntensity;
_originalRemapIntensityZero = RemapIntensityZero;
_originalRemapIntensityOne = RemapIntensityOne;
_originalRelativeIntensity = RelativeIntensity;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * attenuation;
RemapIntensityOne = remapMax * attenuation;
RelativeIntensity = relativeIntensity;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_motionBlur.intensity.Override(_initialIntensity);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
ShakeIntensity = _originalShakeIntensity;
RemapIntensityZero = _originalRemapIntensityZero;
RemapIntensityOne = _originalRemapIntensityOne;
RelativeIntensity = _originalRelativeIntensity;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMMotionBlurShakeEvent_URP.Register(OnMotionBlurShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMMotionBlurShakeEvent_URP.Unregister(OnMotionBlurShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMMotionBlurShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(intensity, duration, remapMin, remapMax, relativeIntensity, attenuation, channelData,
resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9f83ea5980293ee4bb6961962edb0cc1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,192 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP vignette post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMPaniniProjectionShaker_URP")]
public class MMPaniniProjectionShaker_URP : MMShaker
{
[MMInspectorGroup("Distance", true, 62)]
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeDistance = false;
/// the curve used to animate the distance value on
[Tooltip("the curve used to animate the distance value on")]
public AnimationCurve ShakeDistance = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 1f)]
public float RemapDistanceZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 1f)]
public float RemapDistanceOne = 1f;
#if MM_URP
protected Volume _volume;
protected PaniniProjection _paniniProjection;
protected float _initialDistance;
protected float _originalShakeDuration;
protected AnimationCurve _originalShakeDistance;
protected float _originalRemapDistanceZero;
protected float _originalRemapDistanceOne;
protected bool _originalRelativeDistance;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _paniniProjection);
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newValue = ShakeFloat(ShakeDistance, RemapDistanceZero, RemapDistanceOne, RelativeDistance, _initialDistance);
_paniniProjection.distance.Override(newValue);
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialDistance = _paniniProjection.distance.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="distance"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeDistance"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnPaniniProjectionShakeEvent(AnimationCurve distance, float duration, float remapMin, float remapMax, bool relativeDistance = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalShakeDistance = ShakeDistance;
_originalRemapDistanceZero = RemapDistanceZero;
_originalRemapDistanceOne = RemapDistanceOne;
_originalRelativeDistance = RelativeDistance;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeDistance = distance;
RemapDistanceZero = remapMin * attenuation;
RemapDistanceOne = remapMax * attenuation;
RelativeDistance = relativeDistance;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_paniniProjection.distance.Override(_initialDistance);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
ShakeDistance = _originalShakeDistance;
RemapDistanceZero = _originalRemapDistanceZero;
RemapDistanceOne = _originalRemapDistanceOne;
RelativeDistance = _originalRelativeDistance;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMPaniniProjectionShakeEvent_URP.Register(OnPaniniProjectionShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMPaniniProjectionShakeEvent_URP.Unregister(OnPaniniProjectionShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMPaniniProjectionShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve distance, float duration, float remapMin, float remapMax, bool relativeDistance = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve distance, float duration, float remapMin, float remapMax, bool relativeDistance = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(distance, duration, remapMin, remapMax, relativeDistance, attenuation, channelData,
resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d6fe51abeddc2b844abf21fdba23b947
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,192 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a URP vignette post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMVignetteShaker_URP")]
public class MMVignetteShaker_URP : MMShaker
{
[MMInspectorGroup("Vignette Intensity", true, 63)]
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeIntensity = false;
/// the curve used to animate the intensity value on
[Tooltip("the curve used to animate the intensity value on")]
public AnimationCurve ShakeIntensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(0f, 1f)]
public float RemapIntensityOne = 1f;
#if MM_URP
protected Volume _volume;
protected Vignette _vignette;
protected float _initialIntensity;
protected float _originalShakeDuration;
protected AnimationCurve _originalShakeIntensity;
protected float _originalRemapIntensityZero;
protected float _originalRemapIntensityOne;
protected bool _originalRelativeIntensity;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _vignette);
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newValue = ShakeFloat(ShakeIntensity, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, _initialIntensity);
_vignette.intensity.Override(newValue);
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialIntensity = _vignette.intensity.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="intensity"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeIntensity"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnVignetteShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalShakeIntensity = ShakeIntensity;
_originalRemapIntensityZero = RemapIntensityZero;
_originalRemapIntensityOne = RemapIntensityOne;
_originalRelativeIntensity = RelativeIntensity;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * attenuation;
RemapIntensityOne = remapMax * attenuation;
RelativeIntensity = relativeIntensity;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_vignette.intensity.Override(_initialIntensity);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
ShakeIntensity = _originalShakeIntensity;
RemapIntensityZero = _originalRemapIntensityZero;
RemapIntensityOne = _originalRemapIntensityOne;
RelativeIntensity = _originalRelativeIntensity;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMVignetteShakeEvent_URP.Register(OnVignetteShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMVignetteShakeEvent_URP.Unregister(OnVignetteShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMVignetteShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(intensity, duration, remapMin, remapMax, relativeIntensity, attenuation, channelData,
resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 94df1ffae0c2c7d4ba695b68267eea10
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,227 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a white balance post processing and it'll be able to "shake" its values by getting events
/// </summary>
#if MM_URP
[RequireComponent(typeof(Volume))]
#endif
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MMWhiteBalanceShaker_URP")]
public class MMWhiteBalanceShaker_URP : MMShaker
{
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeValues = true;
[MMInspectorGroup("Temperature", true, 55)]
/// the curve used to animate the temperature value on
[Tooltip("the curve used to animate the temperature value on")]
public AnimationCurve ShakeTemperature = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapTemperatureZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapTemperatureOne = 100f;
[MMInspectorGroup("Tint", true, 56)]
/// the curve used to animate the tint value on
[Tooltip("the curve used to animate the tint value on")]
public AnimationCurve ShakeTint = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
/// the value to remap the curve's 0 to
[Tooltip("the value to remap the curve's 0 to")]
[Range(-100f, 100f)]
public float RemapTintZero = 0f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
[Range(-100f, 100f)]
public float RemapTintOne = 100f;
#if MM_URP
protected Volume _volume;
protected WhiteBalance _whiteBalance;
protected float _initialTemperature;
protected float _initialTint;
protected float _originalShakeDuration;
protected bool _originalRelativeValues;
protected AnimationCurve _originalShakeTemperature;
protected float _originalRemapTemperatureZero;
protected float _originalRemapTemperatureOne;
protected AnimationCurve _originalShakeTint;
protected float _originalRemapTintZero;
protected float _originalRemapTintOne;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<Volume>();
_volume.profile.TryGet(out _whiteBalance);
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newTemperature = ShakeFloat(ShakeTemperature, RemapTemperatureZero, RemapTemperatureOne, RelativeValues, _initialTemperature);
_whiteBalance.temperature.Override(newTemperature);
float newTint = ShakeFloat(ShakeTint, RemapTintZero, RemapTintOne, RelativeValues, _initialTint);
_whiteBalance.tint.Override(newTint);
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialTemperature = _whiteBalance.temperature.value;
_initialTint = _whiteBalance.tint.value;
}
/// <summary>
/// When we get the appropriate event, we trigger a shake
/// </summary>
/// <param name="temperature"></param>
/// <param name="duration"></param>
/// <param name="amplitude"></param>
/// <param name="relativeValues"></param>
/// <param name="attenuation"></param>
/// <param name="channel"></param>
public virtual void OnWhiteBalanceShakeEvent(AnimationCurve temperature, float duration, float remapTemperatureMin, float remapTemperatureMax,
AnimationCurve tint, float remapTintMin, float remapTintMax, bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
if (!CheckEventAllowed(channelData) || (!Interruptible && Shaking))
{
return;
}
if (stop)
{
Stop();
return;
}
if (restore)
{
ResetTargetValues();
return;
}
_resetShakerValuesAfterShake = resetShakerValuesAfterShake;
_resetTargetValuesAfterShake = resetTargetValuesAfterShake;
if (resetShakerValuesAfterShake)
{
_originalShakeDuration = ShakeDuration;
_originalShakeTemperature = ShakeTemperature;
_originalRemapTemperatureZero = RemapTemperatureZero;
_originalRemapTemperatureOne = RemapTemperatureOne;
_originalRelativeValues = RelativeValues;
_originalShakeTint = ShakeTint;
_originalRemapTintZero = RemapTintZero;
_originalRemapTintOne = RemapTintOne;
}
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeTemperature = temperature;
RemapTemperatureZero = remapTemperatureMin * attenuation;
RemapTemperatureOne = remapTemperatureMax * attenuation;
RelativeValues = relativeValues;
ShakeTint = tint;
RemapTintZero = remapTintMin;
RemapTintOne = remapTintMax;
ForwardDirection = forwardDirection;
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_whiteBalance.temperature.Override(_initialTemperature);
_whiteBalance.tint.Override(_initialTint);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
ShakeTemperature = _originalShakeTemperature;
RemapTemperatureZero = _originalRemapTemperatureZero;
RemapTemperatureOne = _originalRemapTemperatureOne;
RelativeValues = _originalRelativeValues;
ShakeTint = _originalShakeTint;
RemapTintZero = _originalRemapTintZero;
RemapTintOne = _originalRemapTintOne;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMWhiteBalanceShakeEvent_URP.Register(OnWhiteBalanceShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMWhiteBalanceShakeEvent_URP.Unregister(OnWhiteBalanceShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMWhiteBalanceShakeEvent_URP
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public delegate void Delegate(AnimationCurve temperature, float duration, float remapTemperatureMin, float remapTemperatureMax,
AnimationCurve tint, float remapTintMin, float remapTintMax, bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false);
static public void Trigger(AnimationCurve temperature, float duration, float remapTemperatureMin, float remapTemperatureMax,
AnimationCurve tint, float remapTintMin, float remapTintMax, bool relativeValues = false,
float attenuation = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false)
{
OnEvent?.Invoke(temperature, duration, remapTemperatureMin, remapTemperatureMax,
tint, remapTintMin, remapTintMax, relativeValues,
attenuation, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 413e26d7ac278d24fb4ab58e410a9850
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: