架构大更
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using UnityEngine;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.Feedbacks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting.APIUpdating;
|
||||
#if MM_URP
|
||||
using UnityEngine.Rendering.Universal;
|
||||
@@ -8,147 +8,157 @@ using UnityEngine.Rendering.Universal;
|
||||
namespace MoreMountains.FeedbacksForThirdParty
|
||||
{
|
||||
/// <summary>
|
||||
/// This feedback allows you to control URP depth of field focus distance, aperture and focal length over time.
|
||||
/// It requires you have in your scene an object with a Volume
|
||||
/// with Depth of Field active, and a MMDepthOfFieldShaker_URP component.
|
||||
/// This feedback allows you to control URP depth of field focus distance, aperture and focal length over time.
|
||||
/// It requires you have in your scene an object with a Volume
|
||||
/// with Depth of Field active, and a MMDepthOfFieldShaker_URP component.
|
||||
/// </summary>
|
||||
[AddComponentMenu("")]
|
||||
[FeedbackHelp("This feedback allows you to control URP depth of field focus distance, aperture and focal length over time. " +
|
||||
"It requires you have in your scene an object with a Volume " +
|
||||
"with Depth of Field active, and a MMDepthOfFieldShaker_URP component.")]
|
||||
#if MM_URP
|
||||
[FeedbackPath("PostProcess/Depth Of Field URP")]
|
||||
#endif
|
||||
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
|
||||
public class MMF_DepthOfField_URP : MMF_Feedback
|
||||
{
|
||||
/// a static bool used to disable all feedbacks of this type at once
|
||||
public static bool FeedbackTypeAuthorized = true;
|
||||
/// sets the inspector color for this feedback
|
||||
#if UNITY_EDITOR
|
||||
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
|
||||
public override bool HasCustomInspectors => true;
|
||||
public override bool HasAutomaticShakerSetup => true;
|
||||
#endif
|
||||
[FeedbackHelp(
|
||||
"This feedback allows you to control URP depth of field focus distance, aperture and focal length over time. " +
|
||||
"It requires you have in your scene an object with a Volume " +
|
||||
"with Depth of Field active, and a MMDepthOfFieldShaker_URP component.")]
|
||||
#if MM_URP
|
||||
[FeedbackPath("PostProcess/Depth Of Field URP")]
|
||||
#endif
|
||||
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
|
||||
public class MMF_DepthOfField_URP : MMF_Feedback
|
||||
{
|
||||
/// a static bool used to disable all feedbacks of this type at once
|
||||
public static bool FeedbackTypeAuthorized = true;
|
||||
|
||||
/// 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;
|
||||
/// whether or not to add to the initial values
|
||||
[Tooltip("whether or not to add to the initial values")]
|
||||
public bool RelativeValues = true;
|
||||
|
||||
[MMFInspectorGroup("Depth Of Field", true, 49)]
|
||||
/// the duration of the shake, in seconds
|
||||
[Tooltip("the duration of the shake, in seconds")]
|
||||
public float ShakeDuration = 2f;
|
||||
/// whether or not to add to the initial values
|
||||
[Tooltip("whether or not to add to the initial values")]
|
||||
public bool RelativeValues = true;
|
||||
/// whether or not to reset shaker values after shake
|
||||
[Tooltip("whether or not to reset shaker values after shake")]
|
||||
public bool ResetShakerValuesAfterShake = true;
|
||||
/// whether or not to reset the target's values after shake
|
||||
[Tooltip("whether or not to reset the target's values after shake")]
|
||||
public bool ResetTargetValuesAfterShake = true;
|
||||
/// the value to remap the curve's 1 to
|
||||
[Tooltip("the value to remap the curve's 1 to")] [Range(0.1f, 32f)]
|
||||
public float RemapApertureOne = 32f;
|
||||
|
||||
[MMFInspectorGroup("Focus Distance", true, 50)]
|
||||
/// the curve used to animate the focus distance value on
|
||||
[Tooltip("the curve used to animate the focus distance value on")]
|
||||
public AnimationCurve ShakeFocusDistance = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
/// the value to remap the curve's 0 to
|
||||
[Tooltip("the value to remap the curve's 0 to")]
|
||||
public float RemapFocusDistanceZero = 0f;
|
||||
/// the value to remap the curve's 1 to
|
||||
[Tooltip("the value to remap the curve's 1 to")]
|
||||
public float RemapFocusDistanceOne = 3f;
|
||||
/// the value to remap the curve's 0 to
|
||||
[Tooltip("the value to remap the curve's 0 to")] [Range(0.1f, 32f)]
|
||||
public float RemapApertureZero = .1f;
|
||||
|
||||
[MMFInspectorGroup("Aperture", true, 51)]
|
||||
/// the curve used to animate the aperture value on
|
||||
[Tooltip("the curve used to animate the aperture value on")]
|
||||
public AnimationCurve ShakeAperture = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
/// the value to remap the curve's 0 to
|
||||
[Tooltip("the value to remap the curve's 0 to")]
|
||||
[Range(0.1f, 32f)]
|
||||
public float RemapApertureZero = .1f;
|
||||
/// the value to remap the curve's 1 to
|
||||
[Tooltip("the value to remap the curve's 1 to")]
|
||||
[Range(0.1f, 32f)]
|
||||
public float RemapApertureOne = 32f;
|
||||
/// 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;
|
||||
|
||||
[MMFInspectorGroup("Focal Length", true, 20)]
|
||||
/// the curve used to animate the focal length value on
|
||||
[Tooltip("the curve used to animate the focal length value on")]
|
||||
public AnimationCurve ShakeFocalLength = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
/// the value to remap the curve's 0 to
|
||||
[Tooltip("the value to remap the curve's 0 to")]
|
||||
[Range(0f, 300f)]
|
||||
public float RemapFocalLengthZero = 0f;
|
||||
/// the value to remap the curve's 1 to
|
||||
[Tooltip("the value to remap the curve's 1 to")]
|
||||
[Range(0f, 300f)]
|
||||
public float RemapFocalLengthOne = 0f;
|
||||
/// 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;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers a depth of field event
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="attenuation"></param>
|
||||
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
|
||||
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
|
||||
ShakeAperture, RemapApertureZero, RemapApertureOne,
|
||||
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
|
||||
RelativeValues, intensityMultiplier, ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On stop we stop our transition
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="feedbacksIntensity"></param>
|
||||
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
base.CustomStopFeedback(position, feedbacksIntensity);
|
||||
|
||||
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
|
||||
ShakeAperture, RemapApertureZero, RemapApertureOne,
|
||||
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
|
||||
RelativeValues, channelData: ChannelData, stop: true );
|
||||
}
|
||||
/// the value to remap the curve's 1 to
|
||||
[Tooltip("the value to remap the curve's 1 to")]
|
||||
public float RemapFocusDistanceOne = 3f;
|
||||
|
||||
/// <summary>
|
||||
/// On restore, we put our object back at its initial position
|
||||
/// </summary>
|
||||
protected override void CustomRestoreInitialValues()
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero, RemapFocusDistanceOne,
|
||||
ShakeAperture, RemapApertureZero, RemapApertureOne,
|
||||
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
|
||||
RelativeValues, channelData: ChannelData, restore: true );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automaticall sets up the post processing profile and shaker
|
||||
/// </summary>
|
||||
public override void AutomaticShakerSetup()
|
||||
{
|
||||
#if MM_URP && UNITY_EDITOR
|
||||
MMURPHelpers.GetOrCreateVolume<DepthOfField, MMDepthOfFieldShaker_URP>(Owner, "DepthOfField");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/// the value to remap the curve's 0 to
|
||||
[Tooltip("the value to remap the curve's 0 to")]
|
||||
public float RemapFocusDistanceZero = 0f;
|
||||
|
||||
/// 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("Aperture", true, 51)]
|
||||
/// the curve used to animate the aperture value on
|
||||
[Tooltip("the curve used to animate the aperture value on")]
|
||||
public AnimationCurve ShakeAperture = new(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
|
||||
[MMFInspectorGroup("Depth Of Field", true, 49)]
|
||||
/// the duration of the shake, in seconds
|
||||
[Tooltip("the duration of the shake, in seconds")]
|
||||
public float ShakeDuration = 2f;
|
||||
|
||||
[MMFInspectorGroup("Focal Length", true, 20)]
|
||||
/// the curve used to animate the focal length value on
|
||||
[Tooltip("the curve used to animate the focal length value on")]
|
||||
public AnimationCurve ShakeFocalLength = new(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
|
||||
[MMFInspectorGroup("Focus Distance", true, 50)]
|
||||
/// the curve used to animate the focus distance value on
|
||||
[Tooltip("the curve used to animate the focus distance value on")]
|
||||
public AnimationCurve ShakeFocusDistance = new(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
|
||||
/// the duration of this feedback is the duration of the shake
|
||||
public override float FeedbackDuration
|
||||
{
|
||||
get => ApplyTimeMultiplier(ShakeDuration);
|
||||
set => ShakeDuration = value;
|
||||
}
|
||||
|
||||
public override bool HasChannel => true;
|
||||
public override bool HasRandomness => true;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers a depth of field event
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="attenuation"></param>
|
||||
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
var intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
|
||||
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero,
|
||||
RemapFocusDistanceOne,
|
||||
ShakeAperture, RemapApertureZero, RemapApertureOne,
|
||||
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
|
||||
RelativeValues, intensityMultiplier, ChannelData, ResetShakerValuesAfterShake,
|
||||
ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On stop we stop our transition
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="feedbacksIntensity"></param>
|
||||
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
base.CustomStopFeedback(position, feedbacksIntensity);
|
||||
|
||||
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero,
|
||||
RemapFocusDistanceOne,
|
||||
ShakeAperture, RemapApertureZero, RemapApertureOne,
|
||||
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
|
||||
RelativeValues, channelData: ChannelData, stop: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On restore, we put our object back at its initial position
|
||||
/// </summary>
|
||||
protected override void CustomRestoreInitialValues()
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
|
||||
MMDepthOfFieldShakeEvent_URP.Trigger(ShakeFocusDistance, FeedbackDuration, RemapFocusDistanceZero,
|
||||
RemapFocusDistanceOne,
|
||||
ShakeAperture, RemapApertureZero, RemapApertureOne,
|
||||
ShakeFocalLength, RemapFocalLengthZero, RemapFocalLengthOne,
|
||||
RelativeValues, channelData: ChannelData, restore: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automaticall sets up the post processing profile and shaker
|
||||
/// </summary>
|
||||
public override void AutomaticShakerSetup()
|
||||
{
|
||||
#if MM_URP && UNITY_EDITOR
|
||||
MMURPHelpers.GetOrCreateVolume<DepthOfField, MMDepthOfFieldShaker_URP>(Owner, "DepthOfField");
|
||||
#endif
|
||||
}
|
||||
|
||||
/// sets the inspector color for this feedback
|
||||
#if UNITY_EDITOR
|
||||
public override Color FeedbackColor
|
||||
{
|
||||
get { return MMFeedbacksInspectorColors.PostProcessColor; }
|
||||
}
|
||||
|
||||
public override bool HasCustomInspectors => true;
|
||||
public override bool HasAutomaticShakerSetup => true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using UnityEngine;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.Feedbacks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting.APIUpdating;
|
||||
#if MM_URP
|
||||
using UnityEngine.Rendering.Universal;
|
||||
@@ -8,116 +8,123 @@ using UnityEngine.Rendering.Universal;
|
||||
namespace MoreMountains.FeedbacksForThirdParty
|
||||
{
|
||||
/// <summary>
|
||||
/// This feedback allows you to control URP Film Grain intensity over time.
|
||||
/// It requires you have in your scene an object with a Volume
|
||||
/// with Film Grain active, and a MMFilmGrainShaker_URP component.
|
||||
/// This feedback allows you to control URP Film Grain intensity over time.
|
||||
/// It requires you have in your scene an object with a Volume
|
||||
/// with Film Grain active, and a MMFilmGrainShaker_URP component.
|
||||
/// </summary>
|
||||
[AddComponentMenu("")]
|
||||
#if MM_URP
|
||||
[FeedbackPath("PostProcess/Film Grain URP")]
|
||||
#endif
|
||||
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
|
||||
[FeedbackHelp("This feedback allows you to control Film Grain intensity over time. " +
|
||||
"It requires you have in your scene an object with a Volume " +
|
||||
"with Film Grain active, and a MMFilmGrainShaker_URP component.")]
|
||||
public class MMF_FilmGrain_URP : MMF_Feedback
|
||||
{
|
||||
/// a static bool used to disable all feedbacks of this type at once
|
||||
public static bool FeedbackTypeAuthorized = true;
|
||||
/// sets the inspector color for this feedback
|
||||
#if UNITY_EDITOR
|
||||
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
|
||||
public override bool HasCustomInspectors => true;
|
||||
public override bool HasAutomaticShakerSetup => true;
|
||||
#endif
|
||||
#if MM_URP
|
||||
[FeedbackPath("PostProcess/Film Grain URP")]
|
||||
#endif
|
||||
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
|
||||
[FeedbackHelp("This feedback allows you to control Film Grain intensity over time. " +
|
||||
"It requires you have in your scene an object with a Volume " +
|
||||
"with Film Grain active, and a MMFilmGrainShaker_URP component.")]
|
||||
public class MMF_FilmGrain_URP : MMF_Feedback
|
||||
{
|
||||
/// a static bool used to disable all feedbacks of this type at once
|
||||
public static bool FeedbackTypeAuthorized = true;
|
||||
|
||||
/// the duration of this feedback is the duration of the shake
|
||||
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
|
||||
public override bool HasChannel => true;
|
||||
public override bool HasRandomness => true;
|
||||
[MMFInspectorGroup("Film Grain", true, 21)]
|
||||
/// the duration of the shake, in seconds
|
||||
[Tooltip("the duration of the shake, in seconds")]
|
||||
public float Duration = 0.2f;
|
||||
|
||||
[MMFInspectorGroup("Film Grain", true, 21)]
|
||||
/// the duration of the shake, in seconds
|
||||
[Tooltip("the duration of the shake, in seconds")]
|
||||
public float Duration = 0.2f;
|
||||
/// whether or not to reset shaker values after shake
|
||||
[Tooltip("whether or not to reset shaker values after shake")]
|
||||
public bool ResetShakerValuesAfterShake = true;
|
||||
/// whether or not to reset the target's values after shake
|
||||
[Tooltip("whether or not to reset the target's values after shake")]
|
||||
public bool ResetTargetValuesAfterShake = true;
|
||||
[MMFInspectorGroup("Intensity", true, 22)]
|
||||
/// the curve to animate the intensity on
|
||||
[Tooltip("the curve to animate the intensity on")]
|
||||
public AnimationCurve Intensity = new(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
|
||||
[MMFInspectorGroup("Intensity", true, 22)]
|
||||
/// the curve to animate the intensity on
|
||||
[Tooltip("the curve to animate the intensity on")]
|
||||
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
/// the value to remap the curve's zero to
|
||||
[Tooltip("the value to remap the curve's zero to")]
|
||||
[Range(0f, 1f)]
|
||||
public float RemapIntensityZero = 0f;
|
||||
/// the value to remap the curve's one to
|
||||
[Tooltip("the value to remap the curve's one to")]
|
||||
[Range(0f, 1f)]
|
||||
public float RemapIntensityOne = 1.0f;
|
||||
/// whether or not to add to the initial intensity
|
||||
[Tooltip("whether or not to add to the initial intensity")]
|
||||
public bool RelativeIntensity = false;
|
||||
/// whether or not to add to the initial intensity
|
||||
[Tooltip("whether or not to add to the initial intensity")]
|
||||
public bool RelativeIntensity = false;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers a Film Grain shake
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="attenuation"></param>
|
||||
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
|
||||
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
|
||||
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On stop we stop our transition
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="feedbacksIntensity"></param>
|
||||
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
base.CustomStopFeedback(position, feedbacksIntensity);
|
||||
|
||||
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop:true, channelData: ChannelData);
|
||||
}
|
||||
/// the value to remap the curve's one to
|
||||
[Tooltip("the value to remap the curve's one to")] [Range(0f, 1f)]
|
||||
public float RemapIntensityOne = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// On restore, we put our object back at its initial position
|
||||
/// </summary>
|
||||
protected override void CustomRestoreInitialValues()
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, restore:true, channelData: ChannelData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automaticall sets up the post processing profile and shaker
|
||||
/// </summary>
|
||||
public override void AutomaticShakerSetup()
|
||||
{
|
||||
#if MM_URP && UNITY_EDITOR
|
||||
MMURPHelpers.GetOrCreateVolume<FilmGrain, MMFilmGrainShaker_URP>(Owner, "FilmGrain");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/// the value to remap the curve's zero to
|
||||
[Tooltip("the value to remap the curve's zero to")] [Range(0f, 1f)]
|
||||
public float RemapIntensityZero = 0f;
|
||||
|
||||
/// 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 duration of this feedback is the duration of the shake
|
||||
public override float FeedbackDuration
|
||||
{
|
||||
get => ApplyTimeMultiplier(Duration);
|
||||
set => Duration = value;
|
||||
}
|
||||
|
||||
public override bool HasChannel => true;
|
||||
public override bool HasRandomness => true;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers a Film Grain shake
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="attenuation"></param>
|
||||
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
|
||||
var intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
|
||||
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne,
|
||||
RelativeIntensity, intensityMultiplier,
|
||||
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection,
|
||||
ComputedTimescaleMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On stop we stop our transition
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="feedbacksIntensity"></param>
|
||||
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
base.CustomStopFeedback(position, feedbacksIntensity);
|
||||
|
||||
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne,
|
||||
RelativeIntensity, stop: true, channelData: ChannelData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On restore, we put our object back at its initial position
|
||||
/// </summary>
|
||||
protected override void CustomRestoreInitialValues()
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
|
||||
MMFilmGrainShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne,
|
||||
RelativeIntensity, restore: true, channelData: ChannelData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automaticall sets up the post processing profile and shaker
|
||||
/// </summary>
|
||||
public override void AutomaticShakerSetup()
|
||||
{
|
||||
#if MM_URP && UNITY_EDITOR
|
||||
MMURPHelpers.GetOrCreateVolume<FilmGrain, MMFilmGrainShaker_URP>(Owner, "FilmGrain");
|
||||
#endif
|
||||
}
|
||||
|
||||
/// sets the inspector color for this feedback
|
||||
#if UNITY_EDITOR
|
||||
public override Color FeedbackColor
|
||||
{
|
||||
get { return MMFeedbacksInspectorColors.PostProcessColor; }
|
||||
}
|
||||
|
||||
public override bool HasCustomInspectors => true;
|
||||
public override bool HasAutomaticShakerSetup => true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using UnityEngine;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.Feedbacks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting.APIUpdating;
|
||||
#if MM_URP
|
||||
using UnityEngine.Rendering.Universal;
|
||||
@@ -8,114 +8,121 @@ using UnityEngine.Rendering.Universal;
|
||||
namespace MoreMountains.FeedbacksForThirdParty
|
||||
{
|
||||
/// <summary>
|
||||
/// This feedback allows you to control Panini Projection distance and crop to fit over time.
|
||||
/// It requires you have in your scene an object with a Volume with Bloom active, and a MMPaniniProjectionShaker_URP component.
|
||||
/// This feedback allows you to control Panini Projection distance and crop to fit over time.
|
||||
/// It requires you have in your scene an object with a Volume with Bloom active, and a MMPaniniProjectionShaker_URP
|
||||
/// component.
|
||||
/// </summary>
|
||||
[AddComponentMenu("")]
|
||||
[FeedbackHelp("This feedback allows you to control Panini Projection distance and crop to fit over time. " +
|
||||
"It requires you have in your scene an object with a Volume " +
|
||||
"with PaniniProjection active, and a MMPaniniProjectionShaker_URP component.")]
|
||||
#if MM_URP
|
||||
[FeedbackPath("PostProcess/Panini Projection URP")]
|
||||
#endif
|
||||
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
|
||||
public class MMF_PaniniProjection_URP : MMF_Feedback
|
||||
{
|
||||
/// a static bool used to disable all feedbacks of this type at once
|
||||
public static bool FeedbackTypeAuthorized = true;
|
||||
/// sets the inspector color for this feedback
|
||||
#if UNITY_EDITOR
|
||||
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
|
||||
public override bool HasCustomInspectors => true;
|
||||
public override bool HasAutomaticShakerSetup => true;
|
||||
#endif
|
||||
[FeedbackHelp("This feedback allows you to control Panini Projection distance and crop to fit over time. " +
|
||||
"It requires you have in your scene an object with a Volume " +
|
||||
"with PaniniProjection active, and a MMPaniniProjectionShaker_URP component.")]
|
||||
#if MM_URP
|
||||
[FeedbackPath("PostProcess/Panini Projection URP")]
|
||||
#endif
|
||||
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
|
||||
public class MMF_PaniniProjection_URP : MMF_Feedback
|
||||
{
|
||||
/// a static bool used to disable all feedbacks of this type at once
|
||||
public static bool FeedbackTypeAuthorized = true;
|
||||
|
||||
/// the duration of this feedback is the duration of the shake
|
||||
public override float FeedbackDuration { get { return ApplyTimeMultiplier(Duration); } set { Duration = value; } }
|
||||
public override bool HasChannel => true;
|
||||
public override bool HasRandomness => true;
|
||||
[MMFInspectorGroup("Panini Projection", true, 28)]
|
||||
/// the duration of the shake, in seconds
|
||||
[Tooltip("the duration of the shake, in seconds")]
|
||||
public float Duration = 0.2f;
|
||||
|
||||
[MMFInspectorGroup("Panini Projection", true, 28)]
|
||||
/// the duration of the shake, in seconds
|
||||
[Tooltip("the duration of the shake, in seconds")]
|
||||
public float Duration = 0.2f;
|
||||
/// whether or not to reset shaker values after shake
|
||||
[Tooltip("whether or not to reset shaker values after shake")]
|
||||
public bool ResetShakerValuesAfterShake = true;
|
||||
/// whether or not to reset the target's values after shake
|
||||
[Tooltip("whether or not to reset the target's values after shake")]
|
||||
public bool ResetTargetValuesAfterShake = true;
|
||||
[MMFInspectorGroup("Distance", true, 27)]
|
||||
/// whether or not to add to the initial value
|
||||
[Tooltip("whether or not to add to the initial value")]
|
||||
public bool RelativeDistance = false;
|
||||
|
||||
[MMFInspectorGroup("Distance", true, 27)]
|
||||
/// whether or not to add to the initial value
|
||||
[Tooltip("whether or not to add to the initial value")]
|
||||
public bool RelativeDistance = false;
|
||||
/// the curve used to animate the distance value on
|
||||
[Tooltip("the curve used to animate the distance value on")]
|
||||
public AnimationCurve ShakeDistance = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
/// the value to remap the curve's 0 to
|
||||
[Tooltip("the value to remap the curve's 0 to")]
|
||||
[Range(0f, 1f)]
|
||||
public float RemapDistanceZero = 0f;
|
||||
/// the value to remap the curve's 1 to
|
||||
[Tooltip("the value to remap the curve's 1 to")]
|
||||
[Range(0f, 1f)]
|
||||
public float RemapDistanceOne = 1f;
|
||||
/// the value to remap the curve's 1 to
|
||||
[Tooltip("the value to remap the curve's 1 to")] [Range(0f, 1f)]
|
||||
public float RemapDistanceOne = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers a bloom shake
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="attenuation"></param>
|
||||
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
|
||||
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero, RemapDistanceOne, RelativeDistance, intensityMultiplier, ChannelData,
|
||||
ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On stop we stop our transition
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="feedbacksIntensity"></param>
|
||||
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
base.CustomStopFeedback(position, feedbacksIntensity);
|
||||
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero, RemapDistanceOne, RelativeDistance, channelData: ChannelData, stop: true);
|
||||
}
|
||||
/// the value to remap the curve's 0 to
|
||||
[Tooltip("the value to remap the curve's 0 to")] [Range(0f, 1f)]
|
||||
public float RemapDistanceZero = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// On restore, we put our object back at its initial position
|
||||
/// </summary>
|
||||
protected override void CustomRestoreInitialValues()
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero, RemapDistanceOne, RelativeDistance, channelData: ChannelData, restore: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automaticall sets up the post processing profile and shaker
|
||||
/// </summary>
|
||||
public override void AutomaticShakerSetup()
|
||||
{
|
||||
#if MM_URP && UNITY_EDITOR
|
||||
MMURPHelpers.GetOrCreateVolume<PaniniProjection, MMPaniniProjectionShaker_URP>(Owner, "PaniniProjection");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/// 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 curve used to animate the distance value on
|
||||
[Tooltip("the curve used to animate the distance value on")]
|
||||
public AnimationCurve ShakeDistance = new(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
|
||||
/// the duration of this feedback is the duration of the shake
|
||||
public override float FeedbackDuration
|
||||
{
|
||||
get => ApplyTimeMultiplier(Duration);
|
||||
set => Duration = value;
|
||||
}
|
||||
|
||||
public override bool HasChannel => true;
|
||||
public override bool HasRandomness => true;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers a bloom shake
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="attenuation"></param>
|
||||
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
|
||||
var intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
|
||||
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero,
|
||||
RemapDistanceOne, RelativeDistance, intensityMultiplier, ChannelData,
|
||||
ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On stop we stop our transition
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="feedbacksIntensity"></param>
|
||||
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
base.CustomStopFeedback(position, feedbacksIntensity);
|
||||
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero,
|
||||
RemapDistanceOne, RelativeDistance, channelData: ChannelData, stop: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On restore, we put our object back at its initial position
|
||||
/// </summary>
|
||||
protected override void CustomRestoreInitialValues()
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
|
||||
MMPaniniProjectionShakeEvent_URP.Trigger(ShakeDistance, FeedbackDuration, RemapDistanceZero,
|
||||
RemapDistanceOne, RelativeDistance, channelData: ChannelData, restore: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automaticall sets up the post processing profile and shaker
|
||||
/// </summary>
|
||||
public override void AutomaticShakerSetup()
|
||||
{
|
||||
#if MM_URP && UNITY_EDITOR
|
||||
MMURPHelpers.GetOrCreateVolume<PaniniProjection, MMPaniniProjectionShaker_URP>(Owner, "PaniniProjection");
|
||||
#endif
|
||||
}
|
||||
|
||||
/// sets the inspector color for this feedback
|
||||
#if UNITY_EDITOR
|
||||
public override Color FeedbackColor
|
||||
{
|
||||
get { return MMFeedbacksInspectorColors.PostProcessColor; }
|
||||
}
|
||||
|
||||
public override bool HasCustomInspectors => true;
|
||||
public override bool HasAutomaticShakerSetup => true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using UnityEngine;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.Feedbacks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting.APIUpdating;
|
||||
#if MM_URP
|
||||
using UnityEngine.Rendering.Universal;
|
||||
@@ -8,136 +8,145 @@ using UnityEngine.Rendering.Universal;
|
||||
namespace MoreMountains.FeedbacksForThirdParty
|
||||
{
|
||||
/// <summary>
|
||||
/// This feedback allows you to control URP vignette intensity over time.
|
||||
/// It requires you have in your scene an object with a Volume
|
||||
/// with Vignette active, and a MMVignetteShaker_URP component.
|
||||
/// This feedback allows you to control URP vignette intensity over time.
|
||||
/// It requires you have in your scene an object with a Volume
|
||||
/// with Vignette active, and a MMVignetteShaker_URP component.
|
||||
/// </summary>
|
||||
[AddComponentMenu("")]
|
||||
#if MM_URP
|
||||
[FeedbackPath("PostProcess/Vignette URP")]
|
||||
#endif
|
||||
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
|
||||
[FeedbackHelp("This feedback allows you to control vignette intensity over time. " +
|
||||
"It requires you have in your scene an object with a Volume " +
|
||||
"with Vignette active, and a MMVignetteShaker_URP component.")]
|
||||
public class MMF_Vignette_URP : MMF_Feedback
|
||||
{
|
||||
/// a static bool used to disable all feedbacks of this type at once
|
||||
public static bool FeedbackTypeAuthorized = true;
|
||||
/// sets the inspector color for this feedback
|
||||
#if UNITY_EDITOR
|
||||
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.PostProcessColor; } }
|
||||
public override bool HasCustomInspectors => true;
|
||||
public override bool HasAutomaticShakerSetup => true;
|
||||
#endif
|
||||
#if MM_URP
|
||||
[FeedbackPath("PostProcess/Vignette URP")]
|
||||
#endif
|
||||
[MovedFrom(false, null, "MoreMountains.Feedbacks.URP")]
|
||||
[FeedbackHelp("This feedback allows you to control vignette intensity over time. " +
|
||||
"It requires you have in your scene an object with a Volume " +
|
||||
"with Vignette active, and a MMVignetteShaker_URP component.")]
|
||||
public class MMF_Vignette_URP : MMF_Feedback
|
||||
{
|
||||
/// a static bool used to disable all feedbacks of this type at once
|
||||
public static bool FeedbackTypeAuthorized = true;
|
||||
|
||||
/// 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;
|
||||
/// the curve to animate the color on
|
||||
[Tooltip("the curve to animate the color on")]
|
||||
public AnimationCurve ColorCurve = new(new Keyframe(0, 0), new Keyframe(0.05f, 1f), new Keyframe(0.95f, 1),
|
||||
new Keyframe(1, 0));
|
||||
|
||||
[MMFInspectorGroup("Vignette", true, 28)]
|
||||
/// the duration of the shake, in seconds
|
||||
[Tooltip("the duration of the shake, in seconds")]
|
||||
public float Duration = 0.2f;
|
||||
/// whether or not to reset shaker values after shake
|
||||
[Tooltip("whether or not to reset shaker values after shake")]
|
||||
public bool ResetShakerValuesAfterShake = true;
|
||||
/// whether or not to reset the target's values after shake
|
||||
[Tooltip("whether or not to reset the target's values after shake")]
|
||||
public bool ResetTargetValuesAfterShake = true;
|
||||
[MMFInspectorGroup("Vignette", true, 28)]
|
||||
/// the duration of the shake, in seconds
|
||||
[Tooltip("the duration of the shake, in seconds")]
|
||||
public float Duration = 0.2f;
|
||||
|
||||
[MMFInspectorGroup("Intensity", true, 29)]
|
||||
/// the curve to animate the intensity on
|
||||
[Tooltip("the curve to animate the intensity on")]
|
||||
public AnimationCurve Intensity = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
/// the value to remap the curve's zero to
|
||||
[Tooltip("the value to remap the curve's zero to")]
|
||||
[Range(0f, 1f)]
|
||||
public float RemapIntensityZero = 0f;
|
||||
/// the value to remap the curve's one to
|
||||
[Tooltip("the value to remap the curve's one to")]
|
||||
[Range(0f, 1f)]
|
||||
public float RemapIntensityOne = 1.0f;
|
||||
/// whether or not to add to the initial intensity
|
||||
[Tooltip("whether or not to add to the initial intensity")]
|
||||
public bool RelativeIntensity = false;
|
||||
|
||||
[Header("Color")]
|
||||
/// whether or not to also animate the vignette's color
|
||||
[Tooltip("whether or not to also animate the vignette's color")]
|
||||
public bool InterpolateColor = false;
|
||||
/// the curve to animate the color on
|
||||
[Tooltip("the curve to animate the color on")]
|
||||
public AnimationCurve ColorCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.05f, 1f), new Keyframe(0.95f, 1), new Keyframe(1, 0));
|
||||
/// the value to remap the curve's 0 to
|
||||
[Tooltip("the value to remap the curve's 0 to")]
|
||||
[Range(0, 1)]
|
||||
public float RemapColorZero = 0f;
|
||||
/// the value to remap the curve's 1 to
|
||||
[Tooltip("the value to remap the curve's 1 to")]
|
||||
[Range(0f, 1f)]
|
||||
public float RemapColorOne = 1f;
|
||||
/// the color to lerp towards
|
||||
[Tooltip("the color to lerp towards")]
|
||||
public Color TargetColor = Color.red;
|
||||
[MMFInspectorGroup("Intensity", true, 29)]
|
||||
/// the curve to animate the intensity on
|
||||
[Tooltip("the curve to animate the intensity on")]
|
||||
public AnimationCurve Intensity = new(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
|
||||
|
||||
/// <summary>
|
||||
/// Triggers a vignette shake
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="attenuation"></param>
|
||||
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
|
||||
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, intensityMultiplier,
|
||||
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection, ComputedTimescaleMode, false, false, InterpolateColor,
|
||||
ColorCurve, RemapColorZero, RemapColorOne, TargetColor);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On stop we stop our transition
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="feedbacksIntensity"></param>
|
||||
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
|
||||
{
|
||||
base.CustomStopFeedback(position, feedbacksIntensity);
|
||||
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, stop: true, channelData: ChannelData);
|
||||
}
|
||||
[Header("Color")]
|
||||
/// whether or not to also animate the vignette's color
|
||||
[Tooltip("whether or not to also animate the vignette's color")]
|
||||
public bool InterpolateColor = false;
|
||||
|
||||
/// <summary>
|
||||
/// On restore, we put our object back at its initial position
|
||||
/// </summary>
|
||||
protected override void CustomRestoreInitialValues()
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne, RelativeIntensity, restore: true, channelData: ChannelData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automaticall sets up the post processing profile and shaker
|
||||
/// </summary>
|
||||
public override void AutomaticShakerSetup()
|
||||
{
|
||||
#if MM_URP && UNITY_EDITOR
|
||||
MMURPHelpers.GetOrCreateVolume<Vignette, MMVignetteShaker_URP>(Owner, "Vignette");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/// whether or not to add to the initial intensity
|
||||
[Tooltip("whether or not to add to the initial intensity")]
|
||||
public bool RelativeIntensity = false;
|
||||
|
||||
/// 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 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 one to
|
||||
[Tooltip("the value to remap the curve's one to")] [Range(0f, 1f)]
|
||||
public float RemapIntensityOne = 1.0f;
|
||||
|
||||
/// the value to remap the curve's zero to
|
||||
[Tooltip("the value to remap the curve's zero to")] [Range(0f, 1f)]
|
||||
public float RemapIntensityZero = 0f;
|
||||
|
||||
/// 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 color to lerp towards
|
||||
[Tooltip("the color to lerp towards")] public Color TargetColor = Color.red;
|
||||
|
||||
/// the duration of this feedback is the duration of the shake
|
||||
public override float FeedbackDuration
|
||||
{
|
||||
get => ApplyTimeMultiplier(Duration);
|
||||
set => Duration = value;
|
||||
}
|
||||
|
||||
public override bool HasChannel => true;
|
||||
public override bool HasRandomness => true;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers a vignette shake
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="attenuation"></param>
|
||||
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
|
||||
var intensityMultiplier = ComputeIntensity(feedbacksIntensity, position);
|
||||
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne,
|
||||
RelativeIntensity, intensityMultiplier,
|
||||
ChannelData, ResetShakerValuesAfterShake, ResetTargetValuesAfterShake, NormalPlayDirection,
|
||||
ComputedTimescaleMode, false, false, InterpolateColor,
|
||||
ColorCurve, RemapColorZero, RemapColorOne, TargetColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On stop we stop our transition
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="feedbacksIntensity"></param>
|
||||
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
|
||||
{
|
||||
base.CustomStopFeedback(position, feedbacksIntensity);
|
||||
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne,
|
||||
RelativeIntensity, stop: true, channelData: ChannelData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On restore, we put our object back at its initial position
|
||||
/// </summary>
|
||||
protected override void CustomRestoreInitialValues()
|
||||
{
|
||||
if (!Active || !FeedbackTypeAuthorized) return;
|
||||
|
||||
MMVignetteShakeEvent_URP.Trigger(Intensity, FeedbackDuration, RemapIntensityZero, RemapIntensityOne,
|
||||
RelativeIntensity, restore: true, channelData: ChannelData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automaticall sets up the post processing profile and shaker
|
||||
/// </summary>
|
||||
public override void AutomaticShakerSetup()
|
||||
{
|
||||
#if MM_URP && UNITY_EDITOR
|
||||
MMURPHelpers.GetOrCreateVolume<Vignette, MMVignetteShaker_URP>(Owner, "Vignette");
|
||||
#endif
|
||||
}
|
||||
|
||||
/// sets the inspector color for this feedback
|
||||
#if UNITY_EDITOR
|
||||
public override Color FeedbackColor
|
||||
{
|
||||
get { return MMFeedbacksInspectorColors.PostProcessColor; }
|
||||
}
|
||||
|
||||
public override bool HasCustomInspectors => true;
|
||||
public override bool HasAutomaticShakerSetup => true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"reference": "GUID:4a1cb1490dc4df8409b2580d6b44e75e"
|
||||
"reference": "GUID:4a1cb1490dc4df8409b2580d6b44e75e"
|
||||
}
|
||||
Reference in New Issue
Block a user