Feel 5.9.1
The best way to improve your game's feel and make it extra juicy
Loading...
Searching...
No Matches
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 { Absolute , Additive , ToDestination }
 the possible modes this feedback can operate on More...
enum  PossibleAxis {
  XtoYZ , XtoY , XtoZ , YtoXZ ,
  YtoX , YtoZ , ZtoXY , ZtoX ,
  ZtoY
}
 the various axis on which to apply the squash and stretch More...
enum  TimeScales { Scaled , Unscaled }
 the possible timescales for the animation of the scale More...

Public Member Functions

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

Public Attributes

Transform SquashAndStretchTarget
 the object to animate
Modes Mode = Modes.Absolute
PossibleAxis Axis = PossibleAxis.YtoXZ
float AnimateScaleDuration = 0.2f
 the duration of the animation
float RemapCurveZero = 1f
 the value to remap the curve's 0 value to
float RemapCurveOne = 2f
 the value to remap the curve's 1 value to
float Offset = 0f
 how much should be added to the curve
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
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
bool DetermineScaleOnPlay = false
 if this is true, initial and destination scales will be recomputed on every play
float DestinationScale = 2f
 the scale to reach when in ToDestination mode

Static Public Attributes

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

Protected Member Functions

override void AutomateTargetAcquisition ()
 A method meant to be implemented per feedback letting you specify what happens (usually setting a target)
override void CustomInitialization (MMF_Player owner)
 On init we store our initial scale.
virtual void GetInitialScale ()
 Stores initial scale for future use.
virtual void GetAxisScale ()
override void CustomPlayFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 On Play, triggers the scale animation.
virtual IEnumerator ScaleToDestination ()
 An internal coroutine used to scale the target to its destination scale.
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.
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.
virtual void ApplyScale (float newScale)
 Applies the new scale on the selected axis.
override void CustomStopFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 On stop, we interrupt movement if it was active.
override void CustomRestoreInitialValues ()
 On restore, we restore our initial state.

Protected Attributes

Vector3 _initialScale
float _initialAxisScale
Vector3 _newScale
Coroutine _coroutine

Properties

override bool HasAutomatedTargetAcquisition [get]
 sets the inspector color for this feedback
override float FeedbackDuration [get, set]
 the duration of this feedback is the duration of the scale animation
override bool HasRandomness [get]

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 
ZtoXY 
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 )
protected

On Play, triggers the scale animation.

Parameters
position
feedbacksIntensity

◆ 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

◆ 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

◆ HasAutomatedTargetAcquisition

override bool MoreMountains.Feedbacks.MMF_SquashAndStretch.HasAutomatedTargetAcquisition
get

sets the inspector color for this feedback

◆ HasRandomness

override bool MoreMountains.Feedbacks.MMF_SquashAndStretch.HasRandomness
get

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