chore: initial commit

This commit is contained in:
2026-05-08 11:04:00 +08:00
commit f55d2a57c3
6278 changed files with 866081 additions and 0 deletions

View File

@@ -0,0 +1,132 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<Bloom, MMBloomShaker_URP>(Owner, "Bloom");
#endif
}
}
}

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,156 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<ChannelMixer, MMChannelMixerShaker_URP>(Owner, "Channel Mixer");
#endif
}
}
}

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,124 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<ChromaticAberration, MMChromaticAberrationShaker_URP>(Owner, "Chromatic Aberration");
#endif
}
}
}

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,201 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<ColorAdjustments, MMColorAdjustmentsShaker_URP>(Owner, "ColorAdjustments");
#endif
}
}
}

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,154 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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 );
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<DepthOfField, MMDepthOfFieldShaker_URP>(Owner, "DepthOfField");
#endif
}
}
}

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,123 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.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 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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<FilmGrain, MMFilmGrainShaker_URP>(Owner, "FilmGrain");
#endif
}
}
}

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,165 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
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
public override bool HasAutomatedTargetAcquisition => true;
protected override void AutomateTargetAcquisition() => TargetAutoBlend = FindAutomatedTarget<MMGlobalPostProcessingVolumeAutoBlend_URP>();
/// 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.TimeScale = (ComputedTimescaleMode == TimescaleModes.Scaled) ? MMGlobalPostProcessingVolumeAutoBlend_URP.TimeScales.Scaled : MMGlobalPostProcessingVolumeAutoBlend_URP.TimeScales.Unscaled;
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,131 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.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 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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<LensDistortion, MMLensDistortionShaker_URP>(Owner, "LensDistortion");
#endif
}
}
}

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,450 @@
using System.Collections;
using MoreMountains.Feedbacks;
using UnityEngine;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
#if MM_URP
/// <summary>
/// This feedback will let you control a 2D light's intensity, color, falloff, shadow strength and volumetric intensity over time, or instantly.
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you control a 2D light's intensity, color, falloff, shadow strength and volumetric intensity over time, or instantly.")]
[MovedFrom(false, null, "MoreMountains.Feedbacks")]
[FeedbackPath("Lights/Light2D_URP")]
public class MMF_Light2D_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.LightColor; } }
public override bool EvaluateRequiresSetup() { return (BoundLight == null); }
public override string RequiredTargetText { get { return BoundLight != null ? BoundLight.name : ""; } }
public override string RequiresSetupText { get { return "This feedback requires that a BoundLight be set to be able to work properly. You can set one below."; } }
#endif
/// the duration of this feedback is the duration of the light, or 0 if instant
public override float FeedbackDuration { get { return (Mode == Modes.Instant) ? 0f : ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasChannel => true;
public override bool HasRandomness => true;
public override bool HasAutomatedTargetAcquisition => true;
protected override void AutomateTargetAcquisition() => BoundLight = FindAutomatedTarget<Light2D>();
/// the possible modes for this feedback
public enum Modes { OverTime, Instant, ShakerEvent, ToDestination }
[MMFInspectorGroup("Light", true, 37, true)]
/// the light to affect when playing the feedback
[Tooltip("the light to affect when playing the feedback")]
public Light2D BoundLight;
/// whether the feedback should affect the light instantly or over a period of time
[Tooltip("whether the feedback should affect the light instantly or over a period of time")]
public Modes Mode = Modes.OverTime;
/// how long the light should change over time
[Tooltip("how long the light should change over time")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent, (int)Modes.ToDestination)]
public float Duration = 0.2f;
/// whether or not that light should be turned off on start
[Tooltip("whether or not that light should be turned off on start")]
public bool StartsOff = true;
/// if this is true, the light will be disabled when this feedbacks is stopped
[Tooltip("if this is true, the light will be disabled when this feedbacks is stopped")]
public bool DisableOnStop = false;
/// whether or not the values should be relative or not
[Tooltip("whether or not the values should be relative or not")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent, (int)Modes.Instant)]
public bool RelativeValues = true;
/// whether or not to reset shaker values after shake
[Tooltip("whether or not to reset shaker values after shake")]
[MMFEnumCondition("Mode", (int)Modes.ShakerEvent)]
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")]
[MMFEnumCondition("Mode", (int)Modes.ShakerEvent)]
public bool ResetTargetValuesAfterShake = true;
/// whether or not to broadcast a range to only affect certain shakers
[Tooltip("whether or not to broadcast a range to only affect certain shakers")]
[MMFEnumCondition("Mode", (int)Modes.ShakerEvent)]
public bool OnlyBroadcastInRange = false;
/// the range of the event, in units
[Tooltip("the range of the event, in units")]
[MMFEnumCondition("Mode", (int)Modes.ShakerEvent)]
public float EventRange = 100f;
/// the transform to use to broadcast the event as origin point
[Tooltip("the transform to use to broadcast the event as origin point")]
[MMFEnumCondition("Mode", (int)Modes.ShakerEvent)]
public Transform EventOriginTransform;
/// if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over
[Tooltip("if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over")]
public bool AllowAdditivePlays = false;
[MMFInspectorGroup("Color", true, 38, true)]
/// whether or not to modify the color of the light
[Tooltip("whether or not to modify the color of the light")]
public bool ModifyColor = true;
/// the colors to apply to the light over time
[Tooltip("the colors to apply to the light over time")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent)]
public Gradient ColorOverTime;
/// the color to move to in instant mode
[Tooltip("the color to move to in instant mode")]
[MMFEnumCondition("Mode", (int)Modes.Instant, (int)Modes.ShakerEvent)]
public Color InstantColor = Color.red;
/// the color to move to in destination mode
[Tooltip("the color to move to in destination mode")]
[MMFEnumCondition("Mode", (int)Modes.ToDestination)]
public Color ToDestinationColor = Color.red;
[MMFInspectorGroup("Intensity", true, 39, true)]
/// whether or not to modify the intensity of the light
[Tooltip("whether or not to modify the intensity of the light")]
public bool ModifyIntensity = true;
/// the curve to tween the intensity on
[Tooltip("the curve to tween the intensity on")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent, (int)Modes.ToDestination)]
public AnimationCurve IntensityCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.3f, 1f), new Keyframe(1, 0));
/// the value to remap the intensity curve's 0 to
[Tooltip("the value to remap the intensity curve's 0 to")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent)]
public float RemapIntensityZero = 0f;
/// the value to remap the intensity curve's 1 to
[Tooltip("the value to remap the intensity curve's 1 to")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent)]
public float RemapIntensityOne = 1f;
/// the value to move the intensity to in instant mode
[Tooltip("the value to move the intensity to in instant mode")]
[MMFEnumCondition("Mode", (int)Modes.Instant)]
public float InstantIntensity = 1f;
/// the value to move the intensity to in ToDestination mode
[Tooltip("the value to move the intensity to in ToDestination mode")]
[MMFEnumCondition("Mode", (int)Modes.ToDestination)]
public float ToDestinationIntensity = 1f;
[MMFInspectorGroup("Falloff", true, 40, true)]
/// whether or not to modify the falloff of the light
[Tooltip("whether or not to modify the falloff of the light")]
public bool ModifyFalloff = true;
/// the falloff to apply to the light over time
[Tooltip("the falloff to apply to the light over time")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent, (int)Modes.ToDestination)]
public AnimationCurve FalloffCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.3f, 1f), new Keyframe(1, 0));
/// the value to remap the falloff curve's 0 to
[Tooltip("the value to remap the falloff curve's 0 to")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent)]
public float RemapFalloffZero = 0f;
/// the value to remap the falloff curve's 0 to
[Tooltip("the value to remap the falloff curve's 0 to")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent)]
public float RemapFalloffOne = 10f;
/// the value to move the intensity to in instant mode
[Tooltip("the value to move the intensity to in instant mode")]
[MMFEnumCondition("Mode", (int)Modes.Instant)]
public float InstantFalloff = 10f;
/// the value to move the intensity to in ToDestination mode
[Tooltip("the value to move the intensity to in ToDestination mode")]
[MMFEnumCondition("Mode", (int)Modes.ToDestination)]
public float ToDestinationFalloff = 10f;
[MMFInspectorGroup("Shadow Strength", true, 41, true)]
/// whether or not to modify the shadow strength of the light
[Tooltip("whether or not to modify the shadow strength of the light")]
public bool ModifyShadowStrength = true;
/// the shadow strength to apply to the light over time
[Tooltip("the shadow strength to apply to the light over time")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent, (int)Modes.ToDestination)]
public AnimationCurve ShadowStrengthCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.3f, 1f), new Keyframe(1, 0));
/// the value to remap the shadow strength's curve's 0 to
[Tooltip("the value to remap the shadow strength's curve's 0 to")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent)]
public float RemapShadowStrengthZero = 0f;
/// the value to remap the shadow strength's curve's 1 to
[Tooltip("the value to remap the shadow strength's curve's 1 to")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent)]
public float RemapShadowStrengthOne = 1f;
/// the value to move the shadow strength to in instant mode
[Tooltip("the value to move the shadow strength to in instant mode")]
[MMFEnumCondition("Mode", (int)Modes.Instant)]
public float InstantShadowStrength = 1f;
/// the value to move the shadow strength to in ToDestination mode
[Tooltip("the value to move the shadow strength to in ToDestination mode")]
[MMFEnumCondition("Mode", (int)Modes.ToDestination)]
public float ToDestinationShadowStrength = 1f;
[MMFInspectorGroup("Volumetric Intensity", true, 39, true)]
/// whether or not to modify the volumetric intensity of the light
[Tooltip("whether or not to modify the volumetric intensity of the light")]
public bool ModifyVolumetricIntensity = true;
/// the curve to tween the volumetric intensity on
[Tooltip("the curve to tween the volumetric intensity on")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent, (int)Modes.ToDestination)]
public AnimationCurve VolumetricIntensityCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.3f, 1f), new Keyframe(1, 0));
/// the value to remap the volumetric intensity curve's 0 to
[Tooltip("the value to remap the volumetric intensity curve's 0 to")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent)]
public float RemapVolumetricIntensityZero = 0f;
/// the value to remap the volumetric intensity curve's 1 to
[Tooltip("the value to remap the volumetric intensity curve's 1 to")]
[MMFEnumCondition("Mode", (int)Modes.OverTime, (int)Modes.ShakerEvent)]
public float RemapVolumetricIntensityOne = 1f;
/// the value to move the volumetric intensity to in instant mode
[Tooltip("the value to move the volumetric intensity to in instant mode")]
[MMFEnumCondition("Mode", (int)Modes.Instant)]
public float InstantVolumetricIntensity = 1f;
/// the value to move the volumetric intensity to in ToDestination mode
[Tooltip("the value to move the volumetric intensity to in ToDestination mode")]
[MMFEnumCondition("Mode", (int)Modes.ToDestination)]
public float ToDestinationVolumetricIntensity = 1f;
protected float _initialFalloff;
protected float _initialShadowStrength;
protected float _initialIntensity;
protected float _initialVolumetricIntensity;
protected Coroutine _coroutine;
protected Color _initialColor;
protected Color _targetColor;
/// <summary>
/// On init we turn the light off if needed
/// </summary>
/// <param name="owner"></param>
protected override void CustomInitialization(MMF_Player owner)
{
base.CustomInitialization(owner);
if (BoundLight == null)
{
return;
}
_initialFalloff = BoundLight.shapeLightFalloffSize ;
_initialShadowStrength = BoundLight.shadowIntensity;
_initialIntensity = BoundLight.intensity;
_initialVolumetricIntensity = BoundLight.volumeIntensity;
_initialColor = BoundLight.color;
if (EventOriginTransform == null)
{
EventOriginTransform = owner.transform;
}
if (Active)
{
if (StartsOff)
{
Turn(false);
}
}
}
/// <summary>
/// On Play we turn our light on and start an over time coroutine if needed
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
if (Mode == Modes.ToDestination)
{
_initialFalloff = BoundLight.shapeLightFalloffSize ;
_initialShadowStrength = BoundLight.shadowIntensity;
_initialIntensity = BoundLight.intensity;
_initialIntensity = BoundLight.volumeIntensity;
_initialColor = BoundLight.color;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
Turn(true);
switch (Mode)
{
case Modes.Instant:
BoundLight.intensity = InstantIntensity * intensityMultiplier;
BoundLight.intensity = InstantVolumetricIntensity * intensityMultiplier;
BoundLight.shadowIntensity = InstantShadowStrength;
BoundLight.shapeLightFalloffSize = InstantFalloff;
if (ModifyColor)
{
BoundLight.color = InstantColor;
}
break;
case Modes.OverTime:
case Modes.ToDestination:
if (!AllowAdditivePlays && (_coroutine != null))
{
return;
}
if (_coroutine != null) { Owner.StopCoroutine(_coroutine); }
_coroutine = Owner.StartCoroutine(LightSequence(intensityMultiplier));
break;
case Modes.ShakerEvent:
if (EventOriginTransform == null)
{
EventOriginTransform = Owner.transform;
}
MMLight2DShakeEvent.Trigger(FeedbackDuration, RelativeValues, ModifyColor, ColorOverTime, IntensityCurve,
RemapIntensityZero, RemapIntensityOne, FalloffCurve, RemapFalloffZero * intensityMultiplier, RemapFalloffOne * intensityMultiplier,
ShadowStrengthCurve, RemapShadowStrengthZero, RemapShadowStrengthOne, feedbacksIntensity,
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake,
OnlyBroadcastInRange, EventRange, EventOriginTransform.position);
break;
}
}
/// <summary>
/// This coroutine will modify the intensity and color of the light over time
/// </summary>
/// <returns></returns>
protected virtual IEnumerator LightSequence(float intensityMultiplier)
{
IsPlaying = true;
float journey = NormalPlayDirection ? 0f : FeedbackDuration;
while ((journey >= 0) && (journey <= FeedbackDuration) && (FeedbackDuration > 0))
{
float remappedTime = MMFeedbacksHelpers.Remap(journey, 0f, FeedbackDuration, 0f, 1f);
SetLightValues(remappedTime, intensityMultiplier);
journey += NormalPlayDirection ? FeedbackDeltaTime : -FeedbackDeltaTime;
yield return null;
}
SetLightValues(FinalNormalizedTime, intensityMultiplier);
if (DisableOnStop)
{
Turn(false);
}
IsPlaying = false;
_coroutine = null;
yield return null;
}
/// <summary>
/// Sets the various values on the light on a specified time (between 0 and 1)
/// </summary>
/// <param name="time"></param>
protected virtual void SetLightValues(float time, float intensityMultiplier)
{
float intensity = 0f;
float volumeIntensity = 0f;
float falloff = 0f;
float shadowStrength = 0f;
switch (Mode)
{
case Modes.OverTime:
intensity = MMFeedbacksHelpers.Remap(IntensityCurve.Evaluate(time), 0f, 1f, RemapIntensityZero, RemapIntensityOne);
volumeIntensity = MMFeedbacksHelpers.Remap(VolumetricIntensityCurve.Evaluate(time), 0f, 1f, RemapVolumetricIntensityZero, RemapVolumetricIntensityOne);
falloff = MMFeedbacksHelpers.Remap(FalloffCurve.Evaluate(time), 0f, 1f, RemapFalloffZero, RemapFalloffOne);
shadowStrength = MMFeedbacksHelpers.Remap(ShadowStrengthCurve.Evaluate(time), 0f, 1f, RemapShadowStrengthZero, RemapShadowStrengthOne);
_targetColor = ColorOverTime.Evaluate(time);
break;
case Modes.ToDestination:
intensity = Mathf.Lerp(_initialIntensity, ToDestinationIntensity, IntensityCurve.Evaluate(time));
volumeIntensity = Mathf.Lerp(_initialVolumetricIntensity, ToDestinationVolumetricIntensity, VolumetricIntensityCurve.Evaluate(time));
falloff = Mathf.Lerp(_initialFalloff, ToDestinationFalloff, FalloffCurve.Evaluate(time));
shadowStrength = Mathf.Lerp(_initialShadowStrength, ToDestinationShadowStrength, ShadowStrengthCurve.Evaluate(time));
_targetColor = Color.Lerp(_initialColor, ToDestinationColor, time);
break;
}
if (RelativeValues && (Mode != Modes.ToDestination))
{
intensity += _initialIntensity;
volumeIntensity += _initialVolumetricIntensity;
shadowStrength += _initialShadowStrength;
falloff += _initialFalloff;
}
if (ModifyIntensity)
{
BoundLight.intensity = intensity * intensityMultiplier;
}
if (ModifyVolumetricIntensity)
{
BoundLight.volumeIntensity = volumeIntensity * intensityMultiplier;
}
if (ModifyFalloff)
{
BoundLight.shapeLightFalloffSize = falloff;
}
if (ModifyShadowStrength)
{
BoundLight.shadowIntensity = Mathf.Clamp01(shadowStrength);
}
if (ModifyColor)
{
BoundLight.color = _targetColor;
}
}
/// <summary>
/// Turns the light off on stop
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
IsPlaying = false;
if (Active && (_coroutine != null))
{
Owner.StopCoroutine(_coroutine);
_coroutine = null;
}
if (Active && DisableOnStop)
{
Turn(false);
}
}
/// <summary>
/// Turns the light on or off
/// </summary>
/// <param name="status"></param>
protected virtual void Turn(bool status)
{
if (BoundLight == null)
{
return;
}
BoundLight.enabled = status;
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
BoundLight.shapeLightFalloffSize = _initialFalloff;
BoundLight.shadowIntensity = _initialShadowStrength;
BoundLight.intensity = _initialIntensity;
BoundLight.volumeIntensity = _initialVolumetricIntensity;
BoundLight.color = _initialColor;
if (StartsOff)
{
Turn(false);
}
}
}
#endif
}

View File

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

View File

@@ -0,0 +1,122 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.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 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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<MotionBlur, MMMotionBlurShaker_URP>(Owner, "MotionBlur");
#endif
}
}
}

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,121 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<PaniniProjection, MMPaniniProjectionShaker_URP>(Owner, "PaniniProjection");
#endif
}
}
}

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,143 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.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 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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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;
[Header("Color")]
/// whether or not to also animate the vignette's color
[Tooltip("whether or not to also animate the vignette's color")]
public bool InterpolateColor = false;
/// the curve to animate the color on
[Tooltip("the curve to animate the color on")]
public AnimationCurve ColorCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.05f, 1f), new Keyframe(0.95f, 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, 1)]
public float RemapColorZero = 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 RemapColorOne = 1f;
/// the color to lerp towards
[Tooltip("the color to lerp towards")]
public Color TargetColor = Color.red;
/// <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, false, false, InterpolateColor,
ColorCurve, RemapColorZero, RemapColorOne, TargetColor);
}
/// <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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<Vignette, MMVignetteShaker_URP>(Owner, "Vignette");
#endif
}
}
}

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,139 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_URP
using UnityEngine.Rendering.Universal;
#endif
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
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
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; } }
public override bool HasCustomInspectors => true;
public override bool HasAutomaticShakerSetup => true;
#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);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if MM_URP && UNITY_EDITOR
MMURPHelpers.GetOrCreateVolume<WhiteBalance, MMWhiteBalanceShaker_URP>(Owner, "WhiteBalance");
#endif
}
}
}

View File

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