Feel  4.0.1
The best way to improve your game's feel and make it extra juicy
MoreMountains.Feedbacks.MMF_SquashAndStretch Class Reference

This feedback will let you modify the scale of an object on an axis while the other two axis (or only one) get automatically modified to conserve mass More...

Inheritance diagram for MoreMountains.Feedbacks.MMF_SquashAndStretch:
MoreMountains.Feedbacks.MMF_Feedback

Public Types

enum  Modes { Modes.Absolute, Modes.Additive, Modes.ToDestination }
 the possible modes this feedback can operate on More...
 
enum  PossibleAxis {
  PossibleAxis.XtoYZ, PossibleAxis.XtoY, PossibleAxis.XtoZ, PossibleAxis.YtoXZ,
  PossibleAxis.YtoX, PossibleAxis.YtoZ, PossibleAxis.ZtoXZ, PossibleAxis.ZtoX,
  PossibleAxis.ZtoY
}
 the various axis on which to apply the squash and stretch More...
 
enum  TimeScales { TimeScales.Scaled, TimeScales.Unscaled }
 the possible timescales for the animation of the scale More...
 

Public Member Functions

override void OnDisable ()
 On disable we reset our coroutine More...
 

Public Attributes

override bool HasAutomatedTargetAcquisition => true
 sets the inspector color for this feedback More...
 
Transform SquashAndStretchTarget
 the object to animate More...
 
Modes Mode = Modes.Absolute
 
PossibleAxis Axis = PossibleAxis.YtoXZ
 
float AnimateScaleDuration = 0.2f
 the duration of the animation More...
 
float RemapCurveZero = 1f
 the value to remap the curve's 0 value to More...
 
float RemapCurveOne = 2f
 the value to remap the curve's 1 value to More...
 
float Offset = 0f
 how much should be added to the curve More...
 
AnimationCurve AnimateCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.3f, 1.5f), new Keyframe(1, 0))
 the curve along which to animate the scale More...
 
bool AllowAdditivePlays = false
 if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over More...
 
bool DetermineScaleOnPlay = false
 if this is true, initial and destination scales will be recomputed on every play More...
 
float DestinationScale = 2f
 the scale to reach when in ToDestination mode More...
 
override bool HasRandomness => true
 

Static Public Attributes

static bool FeedbackTypeAuthorized = true
 a static bool used to disable all feedbacks of this type at once More...
 

Protected Member Functions

override void AutomateTargetAcquisition ()
 A method meant to be implemented per feedback letting you specify what happens (usually setting a target) More...
 
override void CustomInitialization (MMF_Player owner)
 On init we store our initial scale More...
 
virtual void GetInitialScale ()
 Stores initial scale for future use More...
 
virtual void GetAxisScale ()
 
override void CustomPlayFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 On Play, triggers the scale animation More...
 
virtual IEnumerator ScaleToDestination ()
 An internal coroutine used to scale the target to its destination scale More...
 
virtual IEnumerator AnimateScale (Transform targetTransform, float duration, AnimationCurve curve, PossibleAxis axis, float remapCurveZero=0f, float remapCurveOne=1f)
 An internal coroutine used to animate the scale over time More...
 
virtual void ComputeAndApplyScale (float percent, AnimationCurve curve, float remapCurveZero, float remapCurveOne, Transform targetTransform)
 Computes the new scale based on the current percent, and applies it to the transform More...
 
virtual void ApplyScale (float newScale)
 Applies the new scale on the selected axis More...
 
override void CustomStopFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 On stop, we interrupt movement if it was active More...
 
override void CustomRestoreInitialValues ()
 On restore, we restore our initial state More...
 

Protected Attributes

Vector3 _initialScale
 
float _initialAxisScale
 
Vector3 _newScale
 
Coroutine _coroutine
 

Properties

override float FeedbackDuration [get, set]
 the duration of this feedback is the duration of the scale animation More...
 

Detailed Description

This feedback will let you modify the scale of an object on an axis while the other two axis (or only one) get automatically modified to conserve mass

Member Enumeration Documentation

◆ Modes

the possible modes this feedback can operate on

Enumerator
Absolute 
Additive 
ToDestination 

◆ PossibleAxis

the various axis on which to apply the squash and stretch

Enumerator
XtoYZ 
XtoY 
XtoZ 
YtoXZ 
YtoX 
YtoZ 
ZtoXZ 
ZtoX 
ZtoY 

◆ TimeScales

the possible timescales for the animation of the scale

Enumerator
Scaled 
Unscaled 

Member Function Documentation

◆ AnimateScale()

virtual IEnumerator MoreMountains.Feedbacks.MMF_SquashAndStretch.AnimateScale ( Transform  targetTransform,
float  duration,
AnimationCurve  curve,
PossibleAxis  axis,
float  remapCurveZero = 0f,
float  remapCurveOne = 1f 
)
protectedvirtual

An internal coroutine used to animate the scale over time

Parameters
targetTransform
duration
curveX
curveY
curveZ
multiplier
Returns

◆ ApplyScale()

virtual void MoreMountains.Feedbacks.MMF_SquashAndStretch.ApplyScale ( float  newScale)
protectedvirtual

Applies the new scale on the selected axis

Parameters
newScale

◆ AutomateTargetAcquisition()

override void MoreMountains.Feedbacks.MMF_SquashAndStretch.AutomateTargetAcquisition ( )
protectedvirtual

A method meant to be implemented per feedback letting you specify what happens (usually setting a target)

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ ComputeAndApplyScale()

virtual void MoreMountains.Feedbacks.MMF_SquashAndStretch.ComputeAndApplyScale ( float  percent,
AnimationCurve  curve,
float  remapCurveZero,
float  remapCurveOne,
Transform  targetTransform 
)
protectedvirtual

Computes the new scale based on the current percent, and applies it to the transform

Parameters
percent
curve
remapCurveZero
remapCurveOne
targetTransform

◆ CustomInitialization()

override void MoreMountains.Feedbacks.MMF_SquashAndStretch.CustomInitialization ( MMF_Player  owner)
protectedvirtual

On init we store our initial scale

Parameters
owner

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomPlayFeedback()

override void MoreMountains.Feedbacks.MMF_SquashAndStretch.CustomPlayFeedback ( Vector3  position,
float  feedbacksIntensity = 1.0f 
)
protectedvirtual

On Play, triggers the scale animation

Parameters
position
feedbacksIntensity

Implements MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomRestoreInitialValues()

override void MoreMountains.Feedbacks.MMF_SquashAndStretch.CustomRestoreInitialValues ( )
protectedvirtual

On restore, we restore our initial state

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomStopFeedback()

override void MoreMountains.Feedbacks.MMF_SquashAndStretch.CustomStopFeedback ( Vector3  position,
float  feedbacksIntensity = 1.0f 
)
protectedvirtual

On stop, we interrupt movement if it was active

Parameters
position
feedbacksIntensity

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ GetAxisScale()

virtual void MoreMountains.Feedbacks.MMF_SquashAndStretch.GetAxisScale ( )
protectedvirtual

◆ GetInitialScale()

virtual void MoreMountains.Feedbacks.MMF_SquashAndStretch.GetInitialScale ( )
protectedvirtual

Stores initial scale for future use

◆ OnDisable()

override void MoreMountains.Feedbacks.MMF_SquashAndStretch.OnDisable ( )
virtual

On disable we reset our coroutine

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ ScaleToDestination()

virtual IEnumerator MoreMountains.Feedbacks.MMF_SquashAndStretch.ScaleToDestination ( )
protectedvirtual

An internal coroutine used to scale the target to its destination scale

Returns

Member Data Documentation

◆ _coroutine

Coroutine MoreMountains.Feedbacks.MMF_SquashAndStretch._coroutine
protected

◆ _initialAxisScale

float MoreMountains.Feedbacks.MMF_SquashAndStretch._initialAxisScale
protected

◆ _initialScale

Vector3 MoreMountains.Feedbacks.MMF_SquashAndStretch._initialScale
protected

◆ _newScale

Vector3 MoreMountains.Feedbacks.MMF_SquashAndStretch._newScale
protected

◆ AllowAdditivePlays

bool MoreMountains.Feedbacks.MMF_SquashAndStretch.AllowAdditivePlays = false

if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over

◆ AnimateCurve

AnimationCurve MoreMountains.Feedbacks.MMF_SquashAndStretch.AnimateCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.3f, 1.5f), new Keyframe(1, 0))

the curve along which to animate the scale

◆ AnimateScaleDuration

float MoreMountains.Feedbacks.MMF_SquashAndStretch.AnimateScaleDuration = 0.2f

the duration of the animation

◆ Axis

PossibleAxis MoreMountains.Feedbacks.MMF_SquashAndStretch.Axis = PossibleAxis.YtoXZ

◆ DestinationScale

float MoreMountains.Feedbacks.MMF_SquashAndStretch.DestinationScale = 2f

the scale to reach when in ToDestination mode

◆ DetermineScaleOnPlay

bool MoreMountains.Feedbacks.MMF_SquashAndStretch.DetermineScaleOnPlay = false

if this is true, initial and destination scales will be recomputed on every play

◆ FeedbackTypeAuthorized

bool MoreMountains.Feedbacks.MMF_SquashAndStretch.FeedbackTypeAuthorized = true
static

a static bool used to disable all feedbacks of this type at once

◆ HasAutomatedTargetAcquisition

override bool MoreMountains.Feedbacks.MMF_SquashAndStretch.HasAutomatedTargetAcquisition => true

sets the inspector color for this feedback

◆ HasRandomness

override bool MoreMountains.Feedbacks.MMF_SquashAndStretch.HasRandomness => true

◆ Mode

Modes MoreMountains.Feedbacks.MMF_SquashAndStretch.Mode = Modes.Absolute

the mode this feedback should operate on Absolute : follows the curve Additive : adds to the current scale of the target ToDestination : sets the scale to the destination target, whatever the current scale is

◆ Offset

float MoreMountains.Feedbacks.MMF_SquashAndStretch.Offset = 0f

how much should be added to the curve

◆ RemapCurveOne

float MoreMountains.Feedbacks.MMF_SquashAndStretch.RemapCurveOne = 2f

the value to remap the curve's 1 value to

◆ RemapCurveZero

float MoreMountains.Feedbacks.MMF_SquashAndStretch.RemapCurveZero = 1f

the value to remap the curve's 0 value to

◆ SquashAndStretchTarget

Transform MoreMountains.Feedbacks.MMF_SquashAndStretch.SquashAndStretchTarget

the object to animate

Property Documentation

◆ FeedbackDuration

override float MoreMountains.Feedbacks.MMF_SquashAndStretch.FeedbackDuration
getset

the duration of this feedback is the duration of the scale animation


The documentation for this class was generated from the following file: