Feel  4.3
The best way to improve your game's feel and make it extra juicy
MoreMountains.Feedbacks.MMSpringFloatComponent< T > Class Template Reference

A spring component used to pilot float values on a target More...

Inheritance diagram for MoreMountains.Feedbacks.MMSpringFloatComponent< T >:
MoreMountains.Feedbacks.MMSpringComponentBase MoreMountains.Tools.MMEventListener< MMSpringFloatEvent > MoreMountains.Tools.MMMonoBehaviour

Public Member Functions

virtual void MoveTo (float newValue)
 
virtual void MoveToAdditive (float newValue)
 
virtual void MoveToSubtractive (float newValue)
 
virtual void MoveToRandom ()
 
virtual void MoveToInstant (float newValue)
 
virtual void MoveToRandom (float min, float max)
 
virtual void Bump (float bumpAmount)
 
virtual void BumpRandom ()
 
virtual void BumpRandom (float min, float max)
 
override void Stop ()
 Stops all value movement on this spring More...
 
override void RestoreInitialValue ()
 Restores this spring's initial value More...
 
override void ResetInitialValue ()
 Sets the current value of this spring as its new initial value, overriding the previous one More...
 
override void Finish ()
 Moves this spring to its destination and disables it More...
 
void OnMMEvent (MMSpringFloatEvent springEvent)
 
- Public Member Functions inherited from MoreMountains.Feedbacks.MMSpringComponentBase
virtual void SetVelocityLowThreshold (float threshold)
 Sets the threshold under which the spring will consider its velocity as too low and will self disable More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMSpringFloatEvent >
void OnMMEvent (T eventType)
 

Public Attributes

Target
 
TimeScaleModes TimeScaleMode = TimeScaleModes.Scaled
 whether this spring should run on scaled time (and be impacted by time scale changes) or unscaled time (and not be impacted by time scale changes) More...
 
MMChannelModes ChannelMode = MMChannelModes.Int
 
int Channel = 0
 the channel to listen to - has to match the one on the feedback More...
 
MMChannel MMChannelDefinition = null
 
MMSpringFloat FloatSpring
 
Vector2 MoveToRandomValue = new Vector2(-2f, 2f)
 the min (x) and max (y) values between which a random target value will be picked when calling MoveToRandom More...
 
Vector2 BumpAmountRandomValue = new Vector2(20f, 100f)
 the min (x) and max (y) values between which a random bump value will be picked when calling BumpRandom More...
 
float TestMoveToValue = 2f
 the value to move this spring to when interacting with any of the MoveTo debug buttons in its inspector More...
 
bool MoveToToolbar
 
float TestBumpAmount = 75f
 the amount by which to bump this spring when interacting with the Bump debug button in its inspector More...
 
bool BumpToToolbar
 
bool OtherControlsToToolbar
 
override bool LowVelocity => Mathf.Abs(FloatSpring.Velocity) < _velocityLowThreshold
 
float DeltaTime => (TimeScaleMode == TimeScaleModes.Scaled) ? Time.deltaTime : Time.unscaledDeltaTime
 
- Public Attributes inherited from MoreMountains.Feedbacks.MMSpringComponentBase
virtual bool LowVelocity => false
 whether or not this spring has reached a low enough velocity to self disable More...
 
UnityEvent OnEquilibriumReached
 

Protected Member Functions

override void UpdateSpringValue ()
 Updates the spring's target value More...
 
override void Initialization ()
 Performs initialization for this spring More...
 
virtual void ApplyValue (float newValue)
 
override void GrabCurrentValue ()
 Grabs the current value on the spring's target More...
 
override void Awake ()
 On awake we self disable More...
 
void OnDestroy ()
 
override void TestMoveTo ()
 
override void TestMoveToAdditive ()
 
override void TestMoveToSubtractive ()
 
override void TestMoveToRandom ()
 
override void TestMoveToInstant ()
 
override void TestBump ()
 
override void TestBumpRandom ()
 
- Protected Member Functions inherited from MoreMountains.Feedbacks.MMSpringComponentBase
virtual void Update ()
 On update we update our spring value and self disable if needed More...
 
virtual void Activate ()
 Activates this component More...
 
virtual void SelfDisable ()
 Disables this component More...
 

Properties

virtual float TargetFloat [get, set]
 

Additional Inherited Members

- Public Types inherited from MoreMountains.Feedbacks.MMSpringComponentBase
enum  TimeScaleModes { TimeScaleModes.Unscaled, TimeScaleModes.Scaled }
 the different possible timescale modes for the spring More...
 
- Protected Attributes inherited from MoreMountains.Feedbacks.MMSpringComponentBase
float _velocityLowThreshold = 0.001f
 

Detailed Description

A spring component used to pilot float values on a target

Type Constraints
T :Component 

Member Function Documentation

◆ ApplyValue()

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.ApplyValue ( float  newValue)
protectedvirtual

◆ Awake()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.Awake ( )
protectedvirtual

On awake we self disable

Reimplemented from MoreMountains.Feedbacks.MMSpringComponentBase.

◆ Bump()

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.Bump ( float  bumpAmount)
virtual

◆ BumpRandom() [1/2]

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.BumpRandom ( )
virtual

◆ BumpRandom() [2/2]

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.BumpRandom ( float  min,
float  max 
)
virtual

◆ Finish()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.Finish ( )
virtual

Moves this spring to its destination and disables it

Reimplemented from MoreMountains.Feedbacks.MMSpringComponentBase.

◆ GrabCurrentValue()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.GrabCurrentValue ( )
protectedvirtual

Grabs the current value on the spring's target

Reimplemented from MoreMountains.Feedbacks.MMSpringComponentBase.

◆ Initialization()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.Initialization ( )
protectedvirtual

Performs initialization for this spring

Reimplemented from MoreMountains.Feedbacks.MMSpringComponentBase.

◆ MoveTo()

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.MoveTo ( float  newValue)
virtual

◆ MoveToAdditive()

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.MoveToAdditive ( float  newValue)
virtual

◆ MoveToInstant()

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.MoveToInstant ( float  newValue)
virtual

◆ MoveToRandom() [1/2]

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.MoveToRandom ( )
virtual

◆ MoveToRandom() [2/2]

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.MoveToRandom ( float  min,
float  max 
)
virtual

◆ MoveToSubtractive()

virtual void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.MoveToSubtractive ( float  newValue)
virtual

◆ OnDestroy()

void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.OnDestroy ( )
protected

◆ OnMMEvent()

◆ ResetInitialValue()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.ResetInitialValue ( )
virtual

Sets the current value of this spring as its new initial value, overriding the previous one

Reimplemented from MoreMountains.Feedbacks.MMSpringComponentBase.

◆ RestoreInitialValue()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.RestoreInitialValue ( )
virtual

Restores this spring's initial value

Reimplemented from MoreMountains.Feedbacks.MMSpringComponentBase.

◆ Stop()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.Stop ( )
virtual

Stops all value movement on this spring

Reimplemented from MoreMountains.Feedbacks.MMSpringComponentBase.

◆ TestBump()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TestBump ( )
protectedvirtual

◆ TestBumpRandom()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TestBumpRandom ( )
protectedvirtual

◆ TestMoveTo()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TestMoveTo ( )
protectedvirtual

◆ TestMoveToAdditive()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TestMoveToAdditive ( )
protectedvirtual

◆ TestMoveToInstant()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TestMoveToInstant ( )
protectedvirtual

◆ TestMoveToRandom()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TestMoveToRandom ( )
protectedvirtual

◆ TestMoveToSubtractive()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TestMoveToSubtractive ( )
protectedvirtual

◆ UpdateSpringValue()

override void MoreMountains.Feedbacks.MMSpringFloatComponent< T >.UpdateSpringValue ( )
protectedvirtual

Updates the spring's target value

Reimplemented from MoreMountains.Feedbacks.MMSpringComponentBase.

Member Data Documentation

◆ BumpAmountRandomValue

Vector2 MoreMountains.Feedbacks.MMSpringFloatComponent< T >.BumpAmountRandomValue = new Vector2(20f, 100f)

the min (x) and max (y) values between which a random bump value will be picked when calling BumpRandom

◆ BumpToToolbar

◆ Channel

the channel to listen to - has to match the one on the feedback

◆ ChannelMode

whether to listen on a channel defined by an int or by a MMChannel scriptable object. Ints are simple to setup but can get messy and make it harder to remember what int corresponds to what. MMChannel scriptable objects require you to create them in advance, but come with a readable name and are more scalable

◆ DeltaTime

float MoreMountains.Feedbacks.MMSpringFloatComponent< T >.DeltaTime => (TimeScaleMode == TimeScaleModes.Scaled) ? Time.deltaTime : Time.unscaledDeltaTime

◆ FloatSpring

◆ LowVelocity

override bool MoreMountains.Feedbacks.MMSpringFloatComponent< T >.LowVelocity => Mathf.Abs(FloatSpring.Velocity) < _velocityLowThreshold

◆ MMChannelDefinition

the MMChannel definition asset to use to listen for events. The feedbacks targeting this shaker will have to reference that same MMChannel definition to receive events - to create a MMChannel, right click anywhere in your project (usually in a Data folder) and go MoreMountains > MMChannel, then name it with some unique name

◆ MoveToRandomValue

Vector2 MoreMountains.Feedbacks.MMSpringFloatComponent< T >.MoveToRandomValue = new Vector2(-2f, 2f)

the min (x) and max (y) values between which a random target value will be picked when calling MoveToRandom

◆ MoveToToolbar

◆ OtherControlsToToolbar

bool MoreMountains.Feedbacks.MMSpringFloatComponent< T >.OtherControlsToToolbar

◆ Target

◆ TestBumpAmount

float MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TestBumpAmount = 75f

the amount by which to bump this spring when interacting with the Bump debug button in its inspector

◆ TestMoveToValue

float MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TestMoveToValue = 2f

the value to move this spring to when interacting with any of the MoveTo debug buttons in its inspector

◆ TimeScaleMode

whether this spring should run on scaled time (and be impacted by time scale changes) or unscaled time (and not be impacted by time scale changes)

Property Documentation

◆ TargetFloat

virtual float MoreMountains.Feedbacks.MMSpringFloatComponent< T >.TargetFloat
getset

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