chore: initial commit
This commit is contained in:
132
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Bloom.cs
vendored
Normal file
132
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Bloom.cs
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
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("")]
|
||||
[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
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Bloom.cs.meta
vendored
Normal file
11
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Bloom.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30d11dc2faf07c54ea2ca17622dd3728
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
122
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_ChromaticAberration.cs
vendored
Normal file
122
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_ChromaticAberration.cs
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
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("")]
|
||||
#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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68f2e968d11ecbf46882dff546d9da6b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
187
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_ColorGrading.cs
vendored
Normal file
187
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_ColorGrading.cs
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
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("")]
|
||||
#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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a7e8d0ecb9743b489dc9f0ee9627be6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
156
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_DepthOfField.cs
vendored
Normal file
156
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_DepthOfField.cs
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
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("")]
|
||||
[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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0378a3a19b50e044aafc329deb33665a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,198 @@
|
||||
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("")]
|
||||
[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 bool EvaluateRequiresSetup() { return (TargetAutoBlend == null); }
|
||||
public override string RequiredTargetText { get { return TargetAutoBlend != null ? TargetAutoBlend.name : ""; } }
|
||||
public override string RequiresSetupText { get { return "This feedback requires that a 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>();
|
||||
|
||||
/// 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
|
||||
|
||||
if (TargetAutoBlend == null)
|
||||
{
|
||||
Debug.LogWarning(Owner.name + " : this MMFeedbackGlobalPPVolumeAutoBlend needs a TargetAutoBlend, please set one in its inspector.");
|
||||
return;
|
||||
}
|
||||
if (Mode == Modes.Default)
|
||||
{
|
||||
if (!NormalPlayDirection)
|
||||
{
|
||||
if (BlendAction == Actions.Blend)
|
||||
{
|
||||
TargetAutoBlend.BlendBack();
|
||||
return;
|
||||
}
|
||||
if (BlendAction == Actions.BlendBack)
|
||||
{
|
||||
TargetAutoBlend.Blend();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BlendAction == Actions.Blend)
|
||||
{
|
||||
TargetAutoBlend.Blend();
|
||||
return;
|
||||
}
|
||||
if (BlendAction == Actions.BlendBack)
|
||||
{
|
||||
TargetAutoBlend.BlendBack();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetAutoBlend.BlendDuration = ApplyTimeMultiplier(BlendDuration);
|
||||
TargetAutoBlend.Curve = BlendCurve;
|
||||
TargetAutoBlend.TimeScale = (ComputedTimescaleMode == TimescaleModes.Scaled) ? MMGlobalPostProcessingVolumeAutoBlend.TimeScales.Scaled : MMGlobalPostProcessingVolumeAutoBlend.TimeScales.Unscaled;
|
||||
if (!NormalPlayDirection)
|
||||
{
|
||||
TargetAutoBlend.InitialWeight = FinalWeight;
|
||||
TargetAutoBlend.FinalWeight = InitialWeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
TargetAutoBlend.InitialWeight = InitialWeight;
|
||||
TargetAutoBlend.FinalWeight = FinalWeight;
|
||||
}
|
||||
TargetAutoBlend.ResetToInitialValueOnEnd = ResetToInitialValueOnEnd;
|
||||
TargetAutoBlend.Blend();
|
||||
}
|
||||
#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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9004edcd6234bf449a2d7812b79b5806
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
131
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_LensDistortion.cs
vendored
Normal file
131
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_LensDistortion.cs
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
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("")]
|
||||
#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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80890712e6d1d954e9a1cfbd3b70e79f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
142
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Vignette.cs
vendored
Normal file
142
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Vignette.cs
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
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("")]
|
||||
#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
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Vignette.cs.meta
vendored
Normal file
11
Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/PostProcessing/Feedbacks/MMF_Vignette.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97f57704667c5aa4586dab47e71ecade
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user