Added Feel plugin

This commit is contained in:
journaliciouz
2025-12-11 14:49:16 +01:00
parent 97dce4aaf6
commit 1942a531d4
2820 changed files with 257786 additions and 9 deletions

View File

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

View File

@@ -0,0 +1,133 @@
using UnityEngine;
using MoreMountains.Feedbacks;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
using UnityEngine.Scripting.APIUpdating;
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 PostProcessVolume
/// with Bloom active, and a MMBloomShaker component.
/// </summary>
[AddComponentMenu("")]
[System.Serializable]
[FeedbackHelp("This feedback allows you to control bloom intensity and threshold over time. It requires you have in your scene an object with a PostProcessVolume " +
"with Bloom active, and a MMBloomShaker component.")]
#if MM_POSTPROCESSING
[FeedbackPath("PostProcess/Bloom")]
#endif
[MovedFrom(false, null, "MoreMountains.Feedbacks.PostProcessing")]
public class MMF_Bloom : 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 string RequiredTargetText => RequiredChannelText;
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 = 10f;
[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="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMBloomShakeEvent.Trigger(ShakeIntensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, ShakeThreshold, RemapThresholdZero, RemapThresholdOne,
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);
MMBloomShakeEvent.Trigger(ShakeIntensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, ShakeThreshold, RemapThresholdZero, RemapThresholdOne,
RelativeValues, stop:true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMBloomShakeEvent.Trigger(ShakeIntensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, ShakeThreshold, RemapThresholdZero, RemapThresholdOne,
RelativeValues, restore:true);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if UNITY_EDITOR && MM_POSTPROCESSING
MMPostProcessingHelpers.GetOrCreateVolume<Bloom, MMBloomShaker>(Owner, "Bloom");
#endif
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 30d11dc2faf07c54ea2ca17622dd3728
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Bloom.cs
uploadId: 830868

View File

@@ -0,0 +1,123 @@
using UnityEngine;
using MoreMountains.Feedbacks;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
using UnityEngine.Scripting.APIUpdating;
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 PostProcessVolume
/// with Chromatic Aberration active, and a MMChromaticAberrationShaker component.
/// </summary>
[AddComponentMenu("")]
[System.Serializable]
#if MM_POSTPROCESSING
[FeedbackPath("PostProcess/Chromatic Aberration")]
#endif
[MovedFrom(false, null, "MoreMountains.Feedbacks.PostProcessing")]
[FeedbackHelp("This feedback allows you to control chromatic aberration intensity over time. It requires you have in your scene an object with a PostProcessVolume " +
"with Chromatic Aberration active, and a MMChromaticAberrationShaker component.")]
public class MMF_ChromaticAberration : 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 string RequiredTargetText => RequiredChannelText;
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, 44)]
/// 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, 45)]
/// 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="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMChromaticAberrationShakeEvent.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.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop:true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMChromaticAberrationShakeEvent.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, restore:true);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if UNITY_EDITOR && MM_POSTPROCESSING
MMPostProcessingHelpers.GetOrCreateVolume<ChromaticAberration, MMChromaticAberrationShaker>(Owner, "Chromatic Aberration");
#endif
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 68f2e968d11ecbf46882dff546d9da6b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_ChromaticAberration.cs
uploadId: 830868

View File

@@ -0,0 +1,188 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control color grading post exposure, hue shift, saturation and contrast over time.
/// It requires you have in your scene an object with a PostProcessVolume
/// with Color Grading active, and a MMColorGradingShaker component.
/// </summary>
[AddComponentMenu("")]
[System.Serializable]
#if MM_POSTPROCESSING
[FeedbackPath("PostProcess/Color Grading")]
#endif
[MovedFrom(false, null, "MoreMountains.Feedbacks.PostProcessing")]
[FeedbackHelp("This feedback allows you to control color grading post exposure, hue shift, saturation and contrast over time. " +
"It requires you have in your scene an object with a PostProcessVolume " +
"with Color Grading active, and a MMColorGradingShaker component.")]
public class MMF_ColorGrading : 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 string RequiredTargetText => RequiredChannelText;
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, 46)]
/// 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, 47)]
/// 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, 48)]
/// 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, 49)]
/// 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, 50)]
/// 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, 50)]
/// if this is true, the color filter will be animated over the gradient below
[Tooltip("if this is true, the color filter will be animated over the gradient below")]
public bool ShakeColorFilter = false;
/// the gradient to use to animate the color filter over time
[Tooltip("the gradient to use to animate the color filter over time")]
[GradientUsage(true)]
public Gradient ColorFilterGradient;
/// <summary>
/// Triggers a color grading shake
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMColorGradingShakeEvent.Trigger(ShakePostExposure, RemapPostExposureZero, RemapPostExposureOne,
ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne,
ShakeSaturation, RemapSaturationZero, RemapSaturationOne,
ShakeContrast, RemapContrastZero, RemapContrastOne,
ShakeColorFilter, ColorFilterGradient,
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);
MMColorGradingShakeEvent.Trigger(ShakePostExposure, RemapPostExposureZero, RemapPostExposureOne,
ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne,
ShakeSaturation, RemapSaturationZero, RemapSaturationOne,
ShakeContrast, RemapContrastZero, RemapContrastOne,
ShakeColorFilter, ColorFilterGradient,
FeedbackDuration,
stop:true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMColorGradingShakeEvent.Trigger(ShakePostExposure, RemapPostExposureZero, RemapPostExposureOne,
ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne,
ShakeSaturation, RemapSaturationZero, RemapSaturationOne,
ShakeContrast, RemapContrastZero, RemapContrastOne,
ShakeColorFilter, ColorFilterGradient,
FeedbackDuration,
restore:true);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if UNITY_EDITOR && MM_POSTPROCESSING
MMPostProcessingHelpers.GetOrCreateVolume<ColorGrading, MMColorGradingShaker>(Owner, "Color Grading");
#endif
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8a7e8d0ecb9743b489dc9f0ee9627be6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_ColorGrading.cs
uploadId: 830868

View File

@@ -0,0 +1,157 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control depth of field focus distance, aperture and focal length over time.
/// It requires you have in your scene an object with a PostProcessVolume
/// with Depth of Field active, and a MMDepthOfFieldShaker component.
/// </summary>
[AddComponentMenu("")]
[System.Serializable]
[FeedbackHelp("This feedback allows you to control depth of field focus distance, aperture and focal length over time. " +
"It requires you have in your scene an object with a PostProcessVolume " +
"with Depth of Field active, and a MMDepthOfFieldShaker component.")]
#if MM_POSTPROCESSING
[FeedbackPath("PostProcess/Depth Of Field")]
#endif
[MovedFrom(false, null, "MoreMountains.Feedbacks.PostProcessing")]
public class MMF_DepthOfField : 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 string RequiredTargetText => RequiredChannelText;
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, 51)]
/// 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, 52)]
/// 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 = 4f;
/// the value to remap the curve's 1 to
[Tooltip("the value to remap the curve's 1 to")]
public float RemapFocusDistanceOne = 50f;
[MMFInspectorGroup("Aperture", true, 53)]
/// 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 = 0.6f;
/// 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 = 0.2f;
[MMFInspectorGroup("Focal Length", true, 54)]
/// 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 = 27.5f;
/// 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 = 27.5f;
/// <summary>
/// Triggers a DoF shake
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMDepthOfFieldShakeEvent.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.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
ShakeAperture, RemapApertureZero, RemapApertureOne,
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
RelativeValues, stop:true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMDepthOfFieldShakeEvent.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
ShakeAperture, RemapApertureZero, RemapApertureOne,
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
RelativeValues, restore:true);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if UNITY_EDITOR && MM_POSTPROCESSING
MMPostProcessingHelpers.GetOrCreateVolume<DepthOfField, MMDepthOfFieldShaker>(Owner, "DepthOfField");
#endif
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 0378a3a19b50e044aafc329deb33665a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_DepthOfField.cs
uploadId: 830868

View File

@@ -0,0 +1,148 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you pilot a Global PostProcessing Volume AutoBlend 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("")]
[System.Serializable]
[FeedbackHelp("This feedback will let you pilot a Global PostProcessing Volume AutoBlend 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_POSTPROCESSING
[FeedbackPath("PostProcess/Global PP Volume Auto Blend")]
#endif
[MovedFrom(false, null, "MoreMountains.Feedbacks.PostProcessing")]
public class MMF_GlobalPPVolumeAutoBlend : MMF_Feedback
{
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
public override string RequiredTargetText { get { return TargetAutoBlend != null ? TargetAutoBlend.name : ""; } }
public override string RequiresSetupText { get { return "This feedback requires that a TargetAutoBlend 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>();
public override bool HasChannel => true;
/// 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 }
/// 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);
}
}
}
}
[MMFInspectorGroup("PostProcess Volume Blend", true, 53, true)]
/// the target auto blend to pilot with this feedback
[Tooltip("the target auto blend to pilot with this feedback")]
public MMGlobalPostProcessingVolumeAutoBlend TargetAutoBlend;
/// the chosen mode
[Tooltip("the chosen mode")]
public Modes Mode = Modes.Default;
/// the chosen action when in default mode
[Tooltip("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
[Tooltip("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
[Tooltip("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
[Tooltip("the weight to blend from")]
[MMFEnumCondition("Mode", (int)Modes.Override)]
public float InitialWeight = 0f;
/// the weight to blend to
[Tooltip("the weight to blend to")]
[MMFEnumCondition("Mode", (int)Modes.Override)]
public float FinalWeight = 1f;
/// whether or not to reset to the initial value at the end of the shake
[Tooltip("whether or not to reset to the initial value at the end of the shake")]
[MMFEnumCondition("Mode", (int)Modes.Override)]
public bool ResetToInitialValueOnEnd = true;
/// <summary>
/// On custom play, triggers a blend on the target blender, overriding its settings 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 MM_POSTPROCESSING
MMGlobalPostProcessingVolumeAutoBlend.TimeScales timeScale = (ComputedTimescaleMode == TimescaleModes.Scaled) ? MMGlobalPostProcessingVolumeAutoBlend.TimeScales.Scaled : MMGlobalPostProcessingVolumeAutoBlend.TimeScales.Unscaled;
MMPostProcessingVolumeAutoBlendShakeEvent.Trigger(ChannelData, TargetAutoBlend, Mode, BlendAction, ApplyTimeMultiplier(BlendDuration), BlendCurve, InitialWeight, FinalWeight, ResetToInitialValueOnEnd, NormalPlayDirection, timeScale);
#endif
}
/// <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;
}
#if MM_POSTPROCESSING
base.CustomStopFeedback(position, feedbacksIntensity);
if (TargetAutoBlend != null)
{
TargetAutoBlend.StopBlending();
}
#endif
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
#if UNITY_EDITOR && MM_POSTPROCESSING
TargetAutoBlend.RestoreInitialValues();
#endif
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 9004edcd6234bf449a2d7812b79b5806
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_GlobalPPVolumeAutoBlend.cs
uploadId: 830868

View File

@@ -0,0 +1,132 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control lens distortion intensity over time.
/// It requires you have in your scene an object with a PostProcessVolume
/// with Lens Distortion active, and a MMLensDistortionShaker component.
/// </summary>
[AddComponentMenu("")]
[System.Serializable]
#if MM_POSTPROCESSING
[FeedbackPath("PostProcess/Lens Distortion")]
#endif
[MovedFrom(false, null, "MoreMountains.Feedbacks.PostProcessing")]
[FeedbackHelp("This feedback allows you to control lens distortion intensity over time. " +
"It requires you have in your scene an object with a PostProcessVolume " +
"with Lens Distortion active, and a MMLensDistortionShaker component.")]
public class MMF_LensDistortion : 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 string RequiredTargetText => RequiredChannelText;
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, 56)]
/// the duration of the shake in seconds
[Tooltip("the duration of the shake in seconds")]
public float Duration = 0.5f;
/// 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, 57)]
/// 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 = 40f;
/// <summary>
/// Triggers a lens distortion shake
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMLensDistortionShakeEvent.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.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop:true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMLensDistortionShakeEvent.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, restore:true);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if UNITY_EDITOR && MM_POSTPROCESSING
MMPostProcessingHelpers.GetOrCreateVolume<LensDistortion, MMLensDistortionShaker>(Owner, "Lens Distortion");
#endif
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 80890712e6d1d954e9a1cfbd3b70e79f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_LensDistortion.cs
uploadId: 830868

View File

@@ -0,0 +1,143 @@
using UnityEngine;
using MoreMountains.Feedbacks;
using UnityEngine.Scripting.APIUpdating;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback allows you to control vignette intensity over time.
/// It requires you have in your scene an object with a PostProcessVolume
/// with Vignette active, and a MMVignetteShaker component.
/// </summary>
[AddComponentMenu("")]
[System.Serializable]
#if MM_POSTPROCESSING
[FeedbackPath("PostProcess/Vignette")]
#endif
[MovedFrom(false, null, "MoreMountains.Feedbacks.PostProcessing")]
[FeedbackHelp("This feedback allows you to control vignette intensity over time. " +
"It requires you have in your scene an object with a PostProcessVolume " +
"with Vignette active, and a MMVignetteShaker component.")]
public class MMF_Vignette : 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 string RequiredTargetText => RequiredChannelText;
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, 58)]
/// 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, 59)]
/// 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 intensity's zero to
[Tooltip("the value to remap the intensity's zero to")]
[Range(0f, 1f)]
public float RemapIntensityZero = 0f;
/// the value to remap the intensity's one to
[Tooltip("the value to remap the intensity'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;
[MMFInspectorGroup("Vignette Color", true, 60)]
/// 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="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
MMVignetteShakeEvent.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)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
MMVignetteShakeEvent.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop:true);
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
MMVignetteShakeEvent.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, restore:true);
}
/// <summary>
/// Automaticall sets up the post processing profile and shaker
/// </summary>
public override void AutomaticShakerSetup()
{
#if UNITY_EDITOR && MM_POSTPROCESSING
MMPostProcessingHelpers.GetOrCreateVolume<Vignette, MMVignetteShaker>(Owner, "Vignette");
#endif
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 97f57704667c5aa4586dab47e71ecade
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Vignette.cs
uploadId: 830868

View File

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

View File

@@ -0,0 +1,354 @@
using System;
using UnityEngine;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#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>
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MM Global Post Processing Volume Auto Blend")]
#if MM_POSTPROCESSING
[RequireComponent(typeof(PostProcessVolume))]
#endif
public class MMGlobalPostProcessingVolumeAutoBlend : MonoBehaviour, MMEventListener<MMPostProcessingVolumeAutoBlendShakeEvent>
{
/// the possible timescales this blend can operate on
public enum TimeScales { Scaled, Unscaled }
/// the possible blend trigger modes
public enum BlendTriggerModes { OnEnable, Script }
[Header("Channel")]
/// whether to listen on a channel defined by an int or by a MMChannel scriptable object. Ints are simple to setup but can get messy and make it harder to remember what int corresponds to what.
/// MMChannel scriptable objects require you to create them in advance, but come with a readable name and are more scalable
[Tooltip("whether to listen on a channel defined by an int or by a MMChannel scriptable object. Ints are simple to setup but can get messy and make it harder to remember what int corresponds to what. " +
"MMChannel scriptable objects require you to create them in advance, but come with a readable name and are more scalable")]
public MMChannelModes ChannelMode = MMChannelModes.Int;
/// the channel to listen to - has to match the one on the feedback
[Tooltip("the channel to listen to - has to match the one on the feedback")]
[MMEnumCondition("ChannelMode", (int)MMChannelModes.Int)]
public int Channel = 0;
/// the MMChannel definition asset to use to listen for events. The feedbacks targeting this shaker will have to reference that same MMChannel definition to receive events - to create a MMChannel,
/// right click anywhere in your project (usually in a Data folder) and go MoreMountains > MMChannel, then name it with some unique name
[Tooltip("the MMChannel definition asset to use to listen for events. The feedbacks targeting this shaker will have to reference that same MMChannel definition to receive events - to create a MMChannel, " +
"right click anywhere in your project (usually in a Data folder) and go MoreMountains > MMChannel, then name it with some unique name")]
[MMEnumCondition("ChannelMode", (int)MMChannelModes.MMChannel)]
public MMChannel MMChannelDefinition = null;
[Header("Blend")]
/// the trigger mode for this MMGlobalPostProcessingVolumeAutoBlend
[Tooltip("the trigger mode for this MMGlobalPostProcessingVolumeAutoBlend")]
public BlendTriggerModes BlendTriggerMode = BlendTriggerModes.Script;
/// the duration of the blend (in seconds)
[Tooltip("the duration of the blend (in seconds)")]
public float BlendDuration = 1f;
/// the curve to use to blend
[Tooltip("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
[Tooltip("the weight at the start of the blend")]
[Range(0f, 1f)]
public float InitialWeight = 0f;
/// the desired weight at the end of the blend
[Tooltip("the desired weight at the end of the blend")]
[Range(0f, 1f)]
public float FinalWeight = 1f;
[Header("Behaviour")]
/// the timescale to operate on
[Tooltip("the timescale to operate on")]
public TimeScales TimeScale = TimeScales.Unscaled;
/// whether or not the associated volume should be disabled at 0
[Tooltip("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
[Tooltip("whether or not this blender should disable itself at 0")]
public bool DisableSelfAfterEnd = true;
/// whether or not this blender can be interrupted
[Tooltip("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
[Tooltip("whether or not this blender should pick the current value as its starting point")]
public bool StartFromCurrentValue = true;
/// reset to initial value on end
[Tooltip("reset to initial value on end ")]
public bool ResetToInitialValueOnEnd = false;
[Header("Tests")]
/// test blend button
[Tooltip("test blend button")]
[MMFInspectorButton("Blend")]
public bool TestBlend;
/// test blend back button
[Tooltip("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_POSTPROCESSING
protected PostProcessVolume _volume;
/// <summary>
/// On Awake we store our volume
/// </summary>
protected virtual void Awake()
{
#if MM_POSTPROCESSING
_volume = this.gameObject.GetComponent<PostProcessVolume>();
_volume.weight = InitialWeight;
this.MMEventStartListening<MMPostProcessingVolumeAutoBlendShakeEvent>();
#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 (_blending && !Interruptable)
{
return;
}
_initial = StartFromCurrentValue ? _volume.weight : InitialWeight;
_destination = FinalWeight;
StartBlending();
}
/// <summary>
/// Blends the volume's weight from the final value to the initial one
/// </summary>
public virtual void BlendBack()
{
if (_blending && !Interruptable)
{
return;
}
_initial = StartFromCurrentValue ? _volume.weight : FinalWeight;
_destination = InitialWeight;
StartBlending();
}
/// <summary>
/// Internal method used to start blending
/// </summary>
protected virtual void StartBlending()
{
_startTime = GetTime();
_blending = true;
this.enabled = true;
if (DisableVolumeOnZeroWeight)
{
_volume.enabled = true;
}
}
/// <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;
}
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 = ResetToInitialValueOnEnd ? _initial : _destination;
_blending = false;
if (DisableVolumeOnZeroWeight && (_volume.weight == 0f))
{
_volume.enabled = false;
}
if (DisableSelfAfterEnd)
{
this.enabled = false;
}
}
}
/// <summary>
/// Restores the volume's weight to its initial value
/// </summary>
public virtual void RestoreInitialValues()
{
_volume.weight = _initial;
}
#endif
/// <summary>
/// When we catch a MMPostProcessingVolumeAutoBlendShakeEvent, we start blending
/// </summary>
/// <param name="eventType"></param>
/// <exception cref="NotImplementedException"></exception>
public void OnMMEvent(MMPostProcessingVolumeAutoBlendShakeEvent shakeEvent)
{
#if MM_POSTPROCESSING
if (shakeEvent.TargetAutoBlend != null)
{
if (!shakeEvent.TargetAutoBlend.Equals(this))
{
return;
}
}
else
{
bool eventMatch = shakeEvent.ChannelData != null && MMChannel.Match(shakeEvent.ChannelData, ChannelMode, Channel, MMChannelDefinition);
if (!eventMatch)
{
return;
}
}
if (shakeEvent.Mode == MMF_GlobalPPVolumeAutoBlend.Modes.Default)
{
if (!shakeEvent.NormalPlayDirection)
{
if (shakeEvent.BlendAction == MMF_GlobalPPVolumeAutoBlend.Actions.Blend)
{
BlendBack();
return;
}
if (shakeEvent.BlendAction == MMF_GlobalPPVolumeAutoBlend.Actions.BlendBack)
{
Blend();
return;
}
}
else
{
if (shakeEvent.BlendAction == MMF_GlobalPPVolumeAutoBlend.Actions.Blend)
{
Blend();
return;
}
if (shakeEvent.BlendAction == MMF_GlobalPPVolumeAutoBlend.Actions.BlendBack)
{
BlendBack();
return;
}
}
}
else
{
BlendDuration = shakeEvent.BlendDuration;
Curve = shakeEvent.BlendCurve;
TimeScale = shakeEvent.TimeScale;
if (!shakeEvent.NormalPlayDirection)
{
InitialWeight = shakeEvent.FinalWeight;
FinalWeight = shakeEvent.InitialWeight;
}
else
{
InitialWeight = shakeEvent.InitialWeight;
FinalWeight = shakeEvent.FinalWeight;
}
ResetToInitialValueOnEnd = shakeEvent.ResetToInitialValueOnEnd;
Blend();
}
#endif
}
/// <summary>
/// On Destroy, we stop listening for events
/// </summary>
protected void OnDestroy()
{
this.MMEventStopListening<MMPostProcessingVolumeAutoBlendShakeEvent>();
}
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMPostProcessingVolumeAutoBlendShakeEvent
{
static MMPostProcessingVolumeAutoBlendShakeEvent e;
public MMChannelData ChannelData;
public MMGlobalPostProcessingVolumeAutoBlend TargetAutoBlend;
public MMF_GlobalPPVolumeAutoBlend.Modes Mode;
public MMF_GlobalPPVolumeAutoBlend.Actions BlendAction;
public float BlendDuration;
public AnimationCurve BlendCurve;
public float InitialWeight;
public float FinalWeight;
public bool ResetToInitialValueOnEnd;
public bool NormalPlayDirection;
public MMGlobalPostProcessingVolumeAutoBlend.TimeScales TimeScale;
public static void Trigger(
MMChannelData channelData,
MMGlobalPostProcessingVolumeAutoBlend targetAutoBlend,
MMF_GlobalPPVolumeAutoBlend.Modes mode,
MMF_GlobalPPVolumeAutoBlend.Actions blendAction,
float blendDuration,
AnimationCurve blendCurve,
float initialWeight,
float finalWeight,
bool resetToInitialValueOnEnd,
bool normalPlayDirection,
MMGlobalPostProcessingVolumeAutoBlend.TimeScales timeScale)
{
e.ChannelData = channelData;
e.TargetAutoBlend = targetAutoBlend;
e.Mode = mode;
e.BlendAction = blendAction;
e.BlendDuration = blendDuration;
e.BlendCurve = blendCurve;
e.InitialWeight = initialWeight;
e.FinalWeight = finalWeight;
e.ResetToInitialValueOnEnd = resetToInitialValueOnEnd;
e.NormalPlayDirection = normalPlayDirection;
e.TimeScale = timeScale;
MMEventManager.TriggerEvent(e);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 2d073f09c04a999428a9149986800bfb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Helpers/MMGlobalPostProcessingVolumeAutoBlend.cs
uploadId: 830868

View File

@@ -0,0 +1,67 @@
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace MoreMountains.FeedbacksForThirdParty
{
public class MMPostProcessingHelpers : MonoBehaviour
{
#if UNITY_EDITOR && MM_POSTPROCESSING
public static void GetOrCreateVolume<T, U>(MMF_Player owner, string feedbackName) where T:PostProcessEffectSettings where U:MMShaker
{
string additions = owner.name + " "+feedbackName+" feedback automatic shaker setup : ";
if (Application.isPlaying)
{
Debug.LogWarning("Automatic shaker setup is only available outside of play mode.");
return;
}
// looks for a post process layer
PostProcessLayer postProcessLayer = Object.FindAnyObjectByType<PostProcessLayer>();
if (postProcessLayer == null)
{
postProcessLayer = Camera.main.gameObject.AddComponent<PostProcessLayer>();
postProcessLayer.volumeLayer = -1;
additions += "Added a PostProcessLayer component to the "+Camera.main.name+" camera. ";
}
// looks for a post processing volume
PostProcessVolume volume = (PostProcessVolume)Object.FindAnyObjectByType(typeof(PostProcessVolume));
if (volume == null)
{
GameObject postProcessingObject = GameObject.Instantiate(Resources.Load<GameObject>("MMDefaultPostProcessingVolume"));
volume = postProcessingObject.GetComponent<PostProcessVolume>();
additions += "Added a PostProcessingVolume to the scene. ";
}
// looks for a setting on the volume
T effect;
if (!volume.sharedProfile.TryGetSettings(out effect))
{
effect = volume.sharedProfile.AddSettings<T>();
AssetDatabase.AddObjectToAsset(effect, volume.sharedProfile);
EditorUtility.SetDirty(volume.sharedProfile);
AssetDatabase.SaveAssets();
additions += "Added a "+feedbackName+" post process effect to the "+volume.gameObject.name+" Post Process Volume. ";
}
// looks for a matching shaker
U shaker = volume.GetComponent<U>();
if (shaker == null)
{
shaker = volume.gameObject.AddComponent<U>();
additions += "Added a "+feedbackName+" Shaker to the "+volume.gameObject.name+" Post Process Volume. ";
}
MMDebug.DebugLogInfo( additions + "You're all set.");
}
#endif
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: c90af9401f16038488cbc1a21e79de15
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Helpers/MMPostProcessingHelpers.cs
uploadId: 830868

View File

@@ -0,0 +1,3 @@
{
"reference": "GUID:4a1cb1490dc4df8409b2580d6b44e75e"
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 6b8430789e6f2fc4fab154da3d6a848a
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/MoreMountains.Feedbacks.PostProcessing.asmref
uploadId: 830868

View File

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

View File

@@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8e6292b2c06870d4495f009f912b9600, type: 3}
m_Name: MMDefaultPostProcessingProfile
m_EditorClassIdentifier:
settings: []

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: c1bea42a5942a4c09a3ecd393f6054aa
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Resources/MMDefaultPostProcessingProfile.asset
uploadId: 830868

View File

@@ -0,0 +1,51 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5003270845818652397
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6453743960439743923}
- component: {fileID: 8467938703123916945}
m_Layer: 0
m_Name: MMDefaultPostProcessingVolume
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6453743960439743923
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5003270845818652397}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8467938703123916945
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5003270845818652397}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3}
m_Name:
m_EditorClassIdentifier:
sharedProfile: {fileID: 11400000, guid: c1bea42a5942a4c09a3ecd393f6054aa, type: 2}
isGlobal: 1
blendDistance: 0
weight: 1
priority: 0

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 948e90df3bdde44068685e4ebecfcc25
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Resources/MMDefaultPostProcessingVolume.prefab
uploadId: 830868

View File

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

View File

@@ -0,0 +1,73 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
using MoreMountains.Feedbacks;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This class will set the depth of field to focus on the set of targets specified in its inspector.
/// </summary>
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MM Auto Focus")]
#if MM_POSTPROCESSING
[RequireComponent(typeof(PostProcessVolume))]
#endif
public class MMAutoFocus : 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;
/// an offset to apply to the focus target
[Tooltip("an offset to apply to the focus target")]
public Vector3 Offset;
[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_POSTPROCESSING
protected PostProcessVolume _volume;
protected PostProcessProfile _profile;
protected DepthOfField _depthOfField;
/// <summary>
/// On start we grab our volume and profile
/// </summary>
void Start()
{
_volume = GetComponent<PostProcessVolume>();
_profile = _volume.profile;
_profile.TryGetSettings<DepthOfField>(out _depthOfField);
}
/// <summary>
/// Adapts DoF to target
/// </summary>
void Update()
{
int focusTargetID = Mathf.FloorToInt(FocusTargetID);
if (focusTargetID < FocusTargets.Length)
{
float distance = Vector3.Distance(CameraTransform.position, FocusTargets[focusTargetID].position + Offset);
_depthOfField.focusDistance.Override(distance);
_depthOfField.aperture.Override(Aperture);
}
}
#endif
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6b05280df6098734a9d93da081ea29f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Shakers/MMAutoFocus.cs
uploadId: 830868

View File

@@ -0,0 +1,220 @@
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a bloom post processing and it'll be able to "shake" its values by getting events
/// </summary>
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MM Bloom Shaker")]
#if MM_POSTPROCESSING
[RequireComponent(typeof(PostProcessVolume))]
#endif
public class MMBloomShaker : MMShaker
{
/// whether or not to add to the initial value
public bool RelativeValues = true;
[MMInspectorGroup("Bloom Intensity", true, 45)]
/// 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 = 10f;
[MMInspectorGroup("Bloom Threshold", true, 46)]
/// 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_POSTPROCESSING
protected PostProcessVolume _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<PostProcessVolume>();
_volume.profile.TryGetSettings(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;
_initialThreshold = _bloom.threshold;
}
/// <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="feedbacksIntensity"></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 feedbacksIntensity = 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;
}
if (!OnlyUseShakerValues)
{
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * feedbacksIntensity;
RemapIntensityOne = remapMax * feedbacksIntensity;
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.Register(OnBloomShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMBloomShakeEvent.Unregister(OnBloomShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMBloomShakeEvent
{
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 feedbacksIntensity = 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 feedbacksIntensity = 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,
feedbacksIntensity, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 04189ce672fd8c349b61eb900b1dc0ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Shakers/MMBloomShaker.cs
uploadId: 830868

View File

@@ -0,0 +1,191 @@
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a chromatic aberration post processing and it'll be able to "shake" its values by getting events
/// </summary>
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MM Chromatic Aberration Shaker")]
#if MM_POSTPROCESSING
[RequireComponent(typeof(PostProcessVolume))]
#endif
public class MMChromaticAberrationShaker : MMShaker
{
[MMInspectorGroup("Chromatic Aberration Intensity", true, 46)]
/// 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_POSTPROCESSING
protected PostProcessVolume _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<PostProcessVolume>();
_volume.profile.TryGetSettings(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;
}
/// <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="feedbacksIntensity"></param>
/// <param name="channel"></param>
public virtual void OnMMChromaticAberrationShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float feedbacksIntensity = 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;
}
if (!OnlyUseShakerValues)
{
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * feedbacksIntensity;
RemapIntensityOne = remapMax * feedbacksIntensity;
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.Register(OnMMChromaticAberrationShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMChromaticAberrationShakeEvent.Unregister(OnMMChromaticAberrationShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMChromaticAberrationShakeEvent
{
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 feedbacksIntensity = 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 feedbacksIntensity = 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, feedbacksIntensity, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 1297b688774526f418895a2f09176619
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Shakers/MMChromaticAberrationShaker.cs
uploadId: 830868

View File

@@ -0,0 +1,334 @@
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a color grading post processing and it'll be able to "shake" its values by getting events
/// </summary>
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MM Color Grading Shaker")]
#if MM_POSTPROCESSING
[RequireComponent(typeof(PostProcessVolume))]
#endif
public class MMColorGradingShaker : MMShaker
{
/// whether or not to add to the initial value
public bool RelativeValues = true;
[MMInspectorGroup("Post Exposure", true, 40)]
/// 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, 49)]
/// 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;
[MMInspectorGroup("Saturation", true, 48)]
/// 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;
[MMFInspectorGroup("Color Filter", true, 50)]
/// if this is true, the color filter will be animated over the gradient below
[Tooltip("if this is true, the color filter will be animated over the gradient below")]
public bool ShakeColorFilter = false;
/// the gradient to use to animate the color filter over time
[Tooltip("the gradient to use to animate the color filter over time")]
[GradientUsage(true)]
public Gradient ColorFilterGradient;
#if MM_POSTPROCESSING
protected PostProcessVolume _volume;
protected ColorGrading _colorGrading;
protected float _initialPostExposure;
protected float _initialHueShift;
protected float _initialSaturation;
protected float _initialContrast;
protected Color _initialColorFilter;
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 bool _originalShakeColorFilter;
protected Gradient _originalColorFilter;
protected Color _newColorFilter;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<PostProcessVolume>();
_volume.profile.TryGetSettings(out _colorGrading);
}
/// <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);
_colorGrading.postExposure.Override(newPostExposure);
float newHueShift = ShakeFloat(ShakeHueShift, RemapHueShiftZero, RemapHueShiftOne, RelativeValues, _initialHueShift);
_colorGrading.hueShift.Override(newHueShift);
float newSaturation = ShakeFloat(ShakeSaturation, RemapSaturationZero, RemapSaturationOne, RelativeValues, _initialSaturation);
_colorGrading.saturation.Override(newSaturation);
float newContrast = ShakeFloat(ShakeContrast, RemapContrastZero, RemapContrastOne, RelativeValues, _initialContrast);
_colorGrading.contrast.Override(newContrast);
if (ShakeColorFilter)
{
_newColorFilter = ShakeGradient(ColorFilterGradient);
_colorGrading.colorFilter.Override(_newColorFilter);
}
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialPostExposure = _colorGrading.postExposure;
_initialHueShift = _colorGrading.hueShift;
_initialSaturation = _colorGrading.saturation;
_initialContrast = _colorGrading.contrast;
_initialColorFilter = _colorGrading.colorFilter;
}
/// <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="feedbacksIntensity"></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,
bool shakeColorFilter, Gradient colorFilterGradient,
float duration, bool relativeValues = false,
float feedbacksIntensity = 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;
_originalShakeColorFilter = ShakeColorFilter;
_originalColorFilter = ColorFilterGradient;
}
if (!OnlyUseShakerValues)
{
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;
ForwardDirection = forwardDirection;
ShakeColorFilter = shakeColorFilter;
ColorFilterGradient = colorFilterGradient;
}
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_colorGrading.postExposure.Override(_initialPostExposure);
_colorGrading.hueShift.Override(_initialHueShift);
_colorGrading.saturation.Override(_initialSaturation);
_colorGrading.contrast.Override(_initialContrast);
_colorGrading.colorFilter.Override(_initialColorFilter);
}
/// <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;
ShakeColorFilter = _originalShakeColorFilter;
ColorFilterGradient = _originalColorFilter;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMColorGradingShakeEvent.Register(OnMMColorGradingShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMColorGradingShakeEvent.Unregister(OnMMColorGradingShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMColorGradingShakeEvent
{
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,
bool shakeColorFilter, Gradient colorFilterGradient,
float duration, bool relativeValues = false,
float feedbacksIntensity = 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,
bool shakeColorFilter, Gradient colorFilterGradient,
float duration, bool relativeValues = false,
float feedbacksIntensity = 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,
shakeColorFilter, colorFilterGradient,
duration, relativeValues, feedbacksIntensity, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 416f266b197306a49975dadec6e05526
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Shakers/MMColorGradingShaker.cs
uploadId: 830868

View File

@@ -0,0 +1,279 @@
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a depth of field post processing and it'll be able to "shake" its values by getting events
/// </summary>
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MM Depth Of Field Shaker")]
#if MM_POSTPROCESSING
[RequireComponent(typeof(PostProcessVolume))]
#endif
public class MMDepthOfFieldShaker : MMShaker
{
/// whether or not to add to the initial value
public bool RelativeValues = true;
[MMInspectorGroup("Focus Distance", true, 49)]
/// 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, 50)]
/// 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 = 0f;
/// 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 = 0f;
[MMInspectorGroup("Focal Length", true, 51)]
/// 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_POSTPROCESSING
protected PostProcessVolume _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<PostProcessVolume>();
_volume.profile.TryGetSettings(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;
_initialAperture = _depthOfField.aperture;
_initialFocalLength = _depthOfField.focalLength;
}
/// <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="feedbacksIntensity"></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 feedbacksIntensity = 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;
}
if (!OnlyUseShakerValues)
{
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.Register(OnDepthOfFieldShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMDepthOfFieldShakeEvent.Unregister(OnDepthOfFieldShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMDepthOfFieldShakeEvent
{
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 feedbacksIntensity = 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 feedbacksIntensity = 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,
feedbacksIntensity, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4792d6bb2cfe7644da1e6972d3da260d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Shakers/MMDepthOfFieldShaker.cs
uploadId: 830868

View File

@@ -0,0 +1,208 @@
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a lens distortion post processing and it'll be able to "shake" its values by getting events
/// </summary>
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MM Lens Distortion Shaker")]
#if MM_POSTPROCESSING
[RequireComponent(typeof(PostProcessVolume))]
#endif
public class MMLensDistortionShaker : 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 = 50f;
#if MM_POSTPROCESSING
protected PostProcessVolume _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<PostProcessVolume>();
_volume.profile.TryGetSettings(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;
}
/// <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="feedbacksIntensity"></param>
/// <param name="channel"></param>
public virtual void OnMMLensDistortionShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float feedbacksIntensity = 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;
}
if (!OnlyUseShakerValues)
{
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * feedbacksIntensity;
RemapIntensityOne = remapMax * feedbacksIntensity;
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.Register(OnMMLensDistortionShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMLensDistortionShakeEvent.Unregister(OnMMLensDistortionShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMLensDistortionShakeEvent
{
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 feedbacksIntensity = 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 feedbacksIntensity = 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, feedbacksIntensity, channelData, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 7efc6a4a233d87b4fbc72cda82ca4a31
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Shakers/MMLensDistortionShaker.cs
uploadId: 830868

View File

@@ -0,0 +1,251 @@
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
#endif
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// Add this class to a Camera with a vignette post processing and it'll be able to "shake" its values by getting events
/// </summary>
[AddComponentMenu("More Mountains/Feedbacks/Shakers/PostProcessing/MM Vignette Shaker")]
#if MM_POSTPROCESSING
[RequireComponent(typeof(PostProcessVolume))]
#endif
public class MMVignetteShaker : MMShaker
{
[MMInspectorGroup("Vignette Intensity", true, 53)]
/// whether or not to add to the initial value
[Tooltip("whether or not to add to the initial value")]
public bool RelativeIntensity = true;
/// 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 = 0.1f;
[MMInspectorGroup("Vignette Color", true, 51)]
/// 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;
#if MM_POSTPROCESSING
protected PostProcessVolume _volume;
protected Vignette _vignette;
protected float _initialIntensity;
protected float _originalShakeDuration;
protected AnimationCurve _originalShakeIntensity;
protected float _originalRemapIntensityZero;
protected float _originalRemapIntensityOne;
protected bool _originalRelativeIntensity;
protected bool _originalInterpolateColor;
protected AnimationCurve _originalColorCurve;
protected float _originalRemapColorZero;
protected float _originalRemapColorOne;
protected Color _originalTargetColor;
protected Color _initialColor;
/// <summary>
/// On init we initialize our values
/// </summary>
protected override void Initialization()
{
base.Initialization();
_volume = this.gameObject.GetComponent<PostProcessVolume>();
_volume.profile.TryGetSettings(out _vignette);
_initialColor = _vignette.color;
}
public virtual void SetVignette(float newValue)
{
_vignette.intensity.Override(newValue);
}
/// <summary>
/// Shakes values over time
/// </summary>
protected override void Shake()
{
float newValue = ShakeFloat(ShakeIntensity, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, _initialIntensity);
_vignette.intensity.Override(newValue);
if (InterpolateColor)
{
float newColorValue = ShakeFloat(ColorCurve, RemapColorZero, RemapColorOne, RelativeIntensity, 0);
_vignette.color.Override(Color.Lerp(_initialColor, TargetColor, newColorValue));
}
}
/// <summary>
/// Collects initial values on the target
/// </summary>
protected override void GrabInitialValues()
{
_initialIntensity = _vignette.intensity;
}
/// <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="feedbacksIntensity"></param>
/// <param name="channel"></param>
public virtual void OnVignetteShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float feedbacksIntensity = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false,
bool interpolateColor = false, AnimationCurve colorCurve = null, float remapColorZero = 0f, float remapColorOne = 1f, Color targetColor = default(Color))
{
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;
_originalInterpolateColor = InterpolateColor;
_originalColorCurve = ColorCurve;
_originalRemapColorZero = RemapColorZero;
_originalRemapColorOne = RemapColorOne;
_originalTargetColor = TargetColor;
}
if (!OnlyUseShakerValues)
{
TimescaleMode = timescaleMode;
ShakeDuration = duration;
ShakeIntensity = intensity;
RemapIntensityZero = remapMin * feedbacksIntensity;
RemapIntensityOne = remapMax * feedbacksIntensity;
RelativeIntensity = relativeIntensity;
ForwardDirection = forwardDirection;
InterpolateColor = interpolateColor;
ColorCurve = colorCurve;
RemapColorZero = remapColorZero;
RemapColorOne = remapColorOne;
TargetColor = targetColor;
}
Play();
}
/// <summary>
/// Resets the target's values
/// </summary>
protected override void ResetTargetValues()
{
base.ResetTargetValues();
_vignette.intensity.Override(_initialIntensity);
_vignette.color.Override(_initialColor);
}
/// <summary>
/// Resets the shaker's values
/// </summary>
protected override void ResetShakerValues()
{
base.ResetShakerValues();
ShakeDuration = _originalShakeDuration;
ShakeIntensity = _originalShakeIntensity;
RemapIntensityZero = _originalRemapIntensityZero;
RemapIntensityOne = _originalRemapIntensityOne;
RelativeIntensity = _originalRelativeIntensity;
InterpolateColor = _originalInterpolateColor;
ColorCurve = _originalColorCurve;
RemapColorZero = _originalRemapColorZero;
RemapColorOne = _originalRemapColorOne;
TargetColor = _originalTargetColor;
}
/// <summary>
/// Starts listening for events
/// </summary>
public override void StartListening()
{
base.StartListening();
MMVignetteShakeEvent.Register(OnVignetteShakeEvent);
}
/// <summary>
/// Stops listening for events
/// </summary>
public override void StopListening()
{
base.StopListening();
MMVignetteShakeEvent.Unregister(OnVignetteShakeEvent);
}
#endif
}
/// <summary>
/// An event used to trigger vignette shakes
/// </summary>
public struct MMVignetteShakeEvent
{
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 feedbacksIntensity = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false,
bool interpolateColor = false, AnimationCurve colorCurve = null, float remapColorZero = 0f, float remapColorOne = 1f, Color targetColor = default(Color));
static public void Trigger(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
float feedbacksIntensity = 1.0f, MMChannelData channelData = null, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false, bool restore = false,
bool interpolateColor = false, AnimationCurve colorCurve = null, float remapColorZero = 0f, float remapColorOne = 1f, Color targetColor = default(Color))
{
OnEvent?.Invoke(intensity, duration, remapMin, remapMax, relativeIntensity, feedbacksIntensity, channelData, resetShakerValuesAfterShake,
resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop, restore,
interpolateColor, colorCurve, remapColorZero, remapColorOne, targetColor);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 81cf12de3b3c98d489779a3382046725
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Shakers/MMVignetteShaker.cs
uploadId: 830868

View File

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

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Bloom Intensity")]
public class MMSpringBloomIntensity : MMSpringFloatComponent<PostProcessVolume>
{
protected Bloom _bloom;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _bloom);
base.Initialization();
}
public override float TargetFloat
{
get => _bloom.intensity;
set => _bloom.intensity.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: e65f2e076950e5b4e87408581f939749
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringBloomIntensity.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Chromatic Aberration Intensity")]
public class MMSpringChromaticAberrationIntensity : MMSpringFloatComponent<PostProcessVolume>
{
protected ChromaticAberration _chromaticAberration;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _chromaticAberration);
base.Initialization();
}
public override float TargetFloat
{
get => _chromaticAberration.intensity;
set => _chromaticAberration.intensity.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 05b2a6b602b3ef04c90ed55c3fa03450
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringChromaticAberrationIntensity.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Color Grading Contrast")]
public class MMSpringColorGradingContrast : MMSpringFloatComponent<PostProcessVolume>
{
protected ColorGrading _colorGrading;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _colorGrading);
base.Initialization();
}
public override float TargetFloat
{
get => _colorGrading.contrast;
set => _colorGrading.contrast.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 273314aadc2d09c4b8f7b497c86f6d3a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringColorGradingContrast.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Color Grading Hue Shift")]
public class MMSpringColorGradingHueShift : MMSpringFloatComponent<PostProcessVolume>
{
protected ColorGrading _colorGrading;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _colorGrading);
base.Initialization();
}
public override float TargetFloat
{
get => _colorGrading.hueShift;
set => _colorGrading.hueShift.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 0cd46e2eb52b6f14aaed1ac0024deeeb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringColorGradingHueShift.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Color Grading Saturation")]
public class MMSpringColorGradingSaturation : MMSpringFloatComponent<PostProcessVolume>
{
protected ColorGrading _colorGrading;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _colorGrading);
base.Initialization();
}
public override float TargetFloat
{
get => _colorGrading.saturation;
set => _colorGrading.saturation.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4cafaf96adab44845be91a12c573cf50
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringColorGradingSaturation.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Color Grading Temperature")]
public class MMSpringColorGradingTemperature : MMSpringFloatComponent<PostProcessVolume>
{
protected ColorGrading _colorGrading;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _colorGrading);
base.Initialization();
}
public override float TargetFloat
{
get => _colorGrading.temperature;
set => _colorGrading.temperature.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: dc41dad25c8ecab4b8dba885fea5e5c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringColorGradingTemperature.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Color Grading Tint")]
public class MMSpringColorGradingTint : MMSpringFloatComponent<PostProcessVolume>
{
protected ColorGrading _colorGrading;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _colorGrading);
base.Initialization();
}
public override float TargetFloat
{
get => _colorGrading.tint;
set => _colorGrading.tint.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f122798344263f34ea0ec3c27298c57a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringColorGradingTint.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Depth Of Field Focus Distance")]
public class MMSpringDepthOfFieldFocusDistance : MMSpringFloatComponent<PostProcessVolume>
{
protected DepthOfField _depthOfField;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _depthOfField);
base.Initialization();
}
public override float TargetFloat
{
get => _depthOfField.focusDistance;
set => _depthOfField.focusDistance.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: df7eb734a87468a40a9194761576a513
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringDepthOfFieldFocusDistance.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Lens Distortion Intensity")]
public class MMSpringLensDistortionIntensity : MMSpringFloatComponent<PostProcessVolume>
{
protected LensDistortion _lensDistortion;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _lensDistortion);
base.Initialization();
}
public override float TargetFloat
{
get => _lensDistortion.intensity;
set => _lensDistortion.intensity.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 3ede055534d39df4bad9ee11f7ab2a13
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringLensDistortionIntensity.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Motion Blur Shutter Angle")]
public class MMSpringMotionBlurShutterAngle : MMSpringFloatComponent<PostProcessVolume>
{
protected MotionBlur _motionBlur;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _motionBlur);
base.Initialization();
}
public override float TargetFloat
{
get => _motionBlur.shutterAngle;
set => _motionBlur.shutterAngle.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 24ee678719e0c084eae35248ed08c192
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringMotionBlurShutterAngle.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Vignette Center")]
public class MMSpringVignetteCenter : MMSpringVector2Component<PostProcessVolume>
{
protected Vignette _vignette;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _vignette);
base.Initialization();
}
public override Vector2 TargetVector2
{
get => _vignette.center;
set => _vignette.center.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: c4cd9f982e331c347a78bcae05117b99
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringVignetteCenter.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
using UnityEngine;
#if MM_POSTPROCESSING
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Vignette Color")]
public class MMSpringVignetteColor : MMSpringColorComponent<PostProcessVolume>
{
protected Vignette _vignette;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _vignette);
base.Initialization();
}
public override Color TargetColor
{
get => _vignette.color;
set => _vignette.color.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 17b834b8463b2c344871f84ca5852a03
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringVignetteColor.cs
uploadId: 830868

View File

@@ -0,0 +1,29 @@
#if MM_POSTPROCESSING
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.Feedbacks
{
[AddComponentMenu("More Mountains/Springs/MM Spring Vignette Intensity")]
public class MMSpringVignetteIntensity : MMSpringFloatComponent<PostProcessVolume>
{
protected Vignette _vignette;
protected override void Initialization()
{
if (Target == null)
{
Target = this.gameObject.GetComponent<PostProcessVolume>();
}
Target.profile.TryGetSettings(out _vignette);
base.Initialization();
}
public override float TargetFloat
{
get => _vignette.intensity;
set => _vignette.intensity.Override(value);
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 33c059583b0a7e44ebd9aa776e815cce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Springs/MMSpringVignetteIntensity.cs
uploadId: 830868