Feel  4.3
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.FloatController Class Reference

A class used to control a float in any other class, over time To use it, simply drag a monobehaviour in its target field, pick a control mode (ping pong or random), and tweak the settings More...

Inheritance diagram for MoreMountains.Tools.FloatController:
MoreMountains.Tools.MMMonoBehaviour

Public Types

enum  ControlModes {
  ControlModes.PingPong, ControlModes.Random, ControlModes.OneTime, ControlModes.AudioAnalyzer,
  ControlModes.ToDestination, ControlModes.Driven
}
 the possible control modes More...
 
enum  AudioAnalyzerModes { AudioAnalyzerModes.Beat, AudioAnalyzerModes.NormalizedBufferedBandLevels }
 

Public Member Functions

virtual bool FindAttribute (string propertyName)
 Finds an attribute (property or field) on the target object More...
 
virtual void Initialization ()
 Grabs the target property and initializes stuff More...
 
virtual void SetDrivenLevelAbsolute (float level)
 Sets the level to the value passed in parameters More...
 
virtual void SetDrivenLevelNormalized (float normalizedLevel, float remapZero, float remapOne)
 Sets the level to the remapped value passed in parameters More...
 
virtual void OneTime ()
 Triggers a one time shake of the float controller More...
 
virtual void ToDestination ()
 Triggers a one time shake of the controller to a specified destination value More...
 
virtual void Stop ()
 Interrupts any tween in progress, and disables itself More...
 
virtual void FillDropDownList ()
 Fills the inspector dropdown with all the possible choices More...
 
virtual void RestoreInitialValues ()
 On restore, we restore our initial state More...
 

Public Attributes

MonoBehaviour TargetObject
 the mono on which the float you want to control is More...
 
ControlModes ControlMode
 the control mode (ping pong or random) More...
 
bool AddToInitialValue = false
 whether or not the updated value should be added to the initial one More...
 
bool UseUnscaledTime = true
 whether or not to use unscaled time More...
 
bool RevertToInitialValueAfterEnd = true
 whether or not you want to revert to the InitialValue after the control ends More...
 
float DrivenLevel = 0f
 the value that will be applied to the controlled float in driven mode More...
 
MMTweenType Curve = new MMTweenType(MMTween.MMTweenCurve.EaseInCubic)
 the curve to apply to the tween More...
 
float MinValue = 0f
 the minimum value for the ping pong More...
 
float MaxValue = 5f
 the maximum value for the ping pong More...
 
float Duration = 1f
 the duration of one ping (or pong) More...
 
float PingPongPauseDuration = 0f
 the duration (in seconds) between a ping and a pong More...
 
Vector2 Amplitude = new Vector2(0f,5f)
 the noise amplitude More...
 
Vector2 Frequency = new Vector2(1f, 1f)
 the noise frequency More...
 
Vector2 Shift = new Vector2(0f, 1f)
 the noise shift More...
 
bool RemapNoiseValues = false
 if this is true, will let you remap the noise value (without amplitude) to the bounds you've specified More...
 
float RemapNoiseZero = 0f
 the value to which to remap the random's zero bound More...
 
float RemapNoiseOne = 1f
 the value to which to remap the random's one bound More...
 
float OneTimeDuration = 1f
 the duration of the One Time shake More...
 
float OneTimeAmplitude = 1f
 the amplitude of the One Time shake (this will be multiplied by the curve's height) More...
 
float OneTimeRemapMin = 0f
 the low value to remap the normalized curve value to More...
 
float OneTimeRemapMax = 1f
 the high value to remap the normalized curve value to More...
 
AnimationCurve OneTimeCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0))
 the curve to apply to the one time shake More...
 
bool DisableAfterOneTime
 whether or not this controller should go to sleep after a one time shake More...
 
bool DisableGameObjectAfterOneTime = false
 whether or not this controller should go back to sleep after a OneTime More...
 
bool OneTimeButton
 a test button for the one time shake More...
 
float ToDestinationDuration = 1f
 the duration of the tween to the destination value More...
 
float ToDestinationValue = 1f
 the value to tween to More...
 
AnimationCurve ToDestinationCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 0.6f), new Keyframe(1f, 1f))
 the curve to use when tweening a value to destination More...
 
bool DisableAfterToDestination
 whether or not this controller should go to sleep after a to destination shake More...
 
bool ToDestinationButton
 a test button for the one time shake More...
 
MMAudioAnalyzer AudioAnalyzer
 the audio analyzer to read the value on More...
 
AudioAnalyzerModes AudioAnalyzerMode = AudioAnalyzerModes.Beat
 whether to look at a Beat or at the normalized buffered band levels More...
 
int BeatID
 the ID of the beat to listen to More...
 
int NormalizedLevelID = 0
 when in NormalizedBufferedBandLevels More...
 
float AudioAnalyzerMultiplier = 1f
 a multiplier to apply to the output beat value More...
 
float InitialValue
 the initial value of the controlled float More...
 
float CurrentValue
 the current value of the controlled float More...
 
float CurrentValueNormalized
 the current value of the controlled float, normalized More...
 
float PingPong
 internal use only More...
 
MonoAttribute TargetAttribute
 internal use only More...
 
string[] AttributeNames
 internal use only More...
 
string PropertyName
 internal use only More...
 
int ChoiceIndex
 internal use only More...
 

Static Public Attributes

const string _undefinedString = "<Undefined Attribute>"
 

Protected Member Functions

virtual void Awake ()
 On start we initialize our controller More...
 
virtual void OnEnable ()
 On enable, grabs the initial value More...
 
virtual float GetInitialValue ()
 Grabs the initial float value More...
 
float GetDeltaTime ()
 Returns the relevant delta time More...
 
float GetTime ()
 Returns the relevant time More...
 
virtual void Update ()
 On Update, we move our value based on the defined settings More...
 
virtual void OnValidate ()
 When the contents of the inspector change, and if the target changed, we grab all its properties and store them More...
 
virtual void OnDisable ()
 On disable we revert to the previous value if needed More...
 

Protected Attributes

List< string > _attributesNamesTempList
 
PropertyInfo[] _propertyReferences
 
FieldInfo[] _fieldReferences
 
bool _attributeFound
 
float _randomAmplitude
 
float _randomFrequency
 
float _randomShift
 
float _elapsedTime = 0f
 
bool _shaking = false
 
float _shakeStartTimestamp = 0f
 
float _remappedTimeSinceStart = 0f
 
float _pingPongDirection = 1f
 
float _lastPingPongPauseAt = 0f
 
float _initialValue = 0f
 
MonoBehaviour _targetObjectLastFrame
 
MonoAttribute _targetAttributeLastFrame
 

Detailed Description

A class used to control a float in any other class, over time To use it, simply drag a monobehaviour in its target field, pick a control mode (ping pong or random), and tweak the settings

Member Enumeration Documentation

◆ AudioAnalyzerModes

Enumerator
Beat 
NormalizedBufferedBandLevels 

◆ ControlModes

the possible control modes

Enumerator
PingPong 
Random 
OneTime 
AudioAnalyzer 
ToDestination 
Driven 

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.FloatController.Awake ( )
protectedvirtual

On start we initialize our controller

◆ FillDropDownList()

virtual void MoreMountains.Tools.FloatController.FillDropDownList ( )
virtual

Fills the inspector dropdown with all the possible choices

◆ FindAttribute()

virtual bool MoreMountains.Tools.FloatController.FindAttribute ( string  propertyName)
virtual

Finds an attribute (property or field) on the target object

Parameters
propertyName
Returns

◆ GetDeltaTime()

float MoreMountains.Tools.FloatController.GetDeltaTime ( )
protected

Returns the relevant delta time

Returns

◆ GetInitialValue()

virtual float MoreMountains.Tools.FloatController.GetInitialValue ( )
protectedvirtual

Grabs the initial float value

Returns

◆ GetTime()

float MoreMountains.Tools.FloatController.GetTime ( )
protected

Returns the relevant time

Returns

◆ Initialization()

virtual void MoreMountains.Tools.FloatController.Initialization ( )
virtual

Grabs the target property and initializes stuff

◆ OnDisable()

virtual void MoreMountains.Tools.FloatController.OnDisable ( )
protectedvirtual

On disable we revert to the previous value if needed

◆ OnEnable()

virtual void MoreMountains.Tools.FloatController.OnEnable ( )
protectedvirtual

On enable, grabs the initial value

◆ OneTime()

virtual void MoreMountains.Tools.FloatController.OneTime ( )
virtual

Triggers a one time shake of the float controller

◆ OnValidate()

virtual void MoreMountains.Tools.FloatController.OnValidate ( )
protectedvirtual

When the contents of the inspector change, and if the target changed, we grab all its properties and store them

◆ RestoreInitialValues()

virtual void MoreMountains.Tools.FloatController.RestoreInitialValues ( )
virtual

On restore, we restore our initial state

◆ SetDrivenLevelAbsolute()

virtual void MoreMountains.Tools.FloatController.SetDrivenLevelAbsolute ( float  level)
virtual

Sets the level to the value passed in parameters

Parameters
level

◆ SetDrivenLevelNormalized()

virtual void MoreMountains.Tools.FloatController.SetDrivenLevelNormalized ( float  normalizedLevel,
float  remapZero,
float  remapOne 
)
virtual

Sets the level to the remapped value passed in parameters

Parameters
normalizedLevel
remapZero
remapOne

◆ Stop()

virtual void MoreMountains.Tools.FloatController.Stop ( )
virtual

Interrupts any tween in progress, and disables itself

◆ ToDestination()

virtual void MoreMountains.Tools.FloatController.ToDestination ( )
virtual

Triggers a one time shake of the controller to a specified destination value

◆ Update()

virtual void MoreMountains.Tools.FloatController.Update ( )
protectedvirtual

On Update, we move our value based on the defined settings

Member Data Documentation

◆ _attributeFound

bool MoreMountains.Tools.FloatController._attributeFound
protected

◆ _attributesNamesTempList

List<string> MoreMountains.Tools.FloatController._attributesNamesTempList
protected

◆ _elapsedTime

float MoreMountains.Tools.FloatController._elapsedTime = 0f
protected

◆ _fieldReferences

FieldInfo [] MoreMountains.Tools.FloatController._fieldReferences
protected

◆ _initialValue

float MoreMountains.Tools.FloatController._initialValue = 0f
protected

◆ _lastPingPongPauseAt

float MoreMountains.Tools.FloatController._lastPingPongPauseAt = 0f
protected

◆ _pingPongDirection

float MoreMountains.Tools.FloatController._pingPongDirection = 1f
protected

◆ _propertyReferences

PropertyInfo [] MoreMountains.Tools.FloatController._propertyReferences
protected

◆ _randomAmplitude

float MoreMountains.Tools.FloatController._randomAmplitude
protected

◆ _randomFrequency

float MoreMountains.Tools.FloatController._randomFrequency
protected

◆ _randomShift

float MoreMountains.Tools.FloatController._randomShift
protected

◆ _remappedTimeSinceStart

float MoreMountains.Tools.FloatController._remappedTimeSinceStart = 0f
protected

◆ _shakeStartTimestamp

float MoreMountains.Tools.FloatController._shakeStartTimestamp = 0f
protected

◆ _shaking

bool MoreMountains.Tools.FloatController._shaking = false
protected

◆ _targetAttributeLastFrame

MonoAttribute MoreMountains.Tools.FloatController._targetAttributeLastFrame
protected

◆ _targetObjectLastFrame

MonoBehaviour MoreMountains.Tools.FloatController._targetObjectLastFrame
protected

◆ _undefinedString

const string MoreMountains.Tools.FloatController._undefinedString = "<Undefined Attribute>"
static

◆ AddToInitialValue

bool MoreMountains.Tools.FloatController.AddToInitialValue = false

whether or not the updated value should be added to the initial one

◆ Amplitude

Vector2 MoreMountains.Tools.FloatController.Amplitude = new Vector2(0f,5f)

the noise amplitude

◆ AttributeNames

string [] MoreMountains.Tools.FloatController.AttributeNames

internal use only

◆ AudioAnalyzer

MMAudioAnalyzer MoreMountains.Tools.FloatController.AudioAnalyzer

the audio analyzer to read the value on

◆ AudioAnalyzerMode

AudioAnalyzerModes MoreMountains.Tools.FloatController.AudioAnalyzerMode = AudioAnalyzerModes.Beat

whether to look at a Beat or at the normalized buffered band levels

◆ AudioAnalyzerMultiplier

float MoreMountains.Tools.FloatController.AudioAnalyzerMultiplier = 1f

a multiplier to apply to the output beat value

◆ BeatID

int MoreMountains.Tools.FloatController.BeatID

the ID of the beat to listen to

◆ ChoiceIndex

int MoreMountains.Tools.FloatController.ChoiceIndex

internal use only

◆ ControlMode

ControlModes MoreMountains.Tools.FloatController.ControlMode

the control mode (ping pong or random)

◆ CurrentValue

float MoreMountains.Tools.FloatController.CurrentValue

the current value of the controlled float

◆ CurrentValueNormalized

float MoreMountains.Tools.FloatController.CurrentValueNormalized

the current value of the controlled float, normalized

◆ Curve

MMTweenType MoreMountains.Tools.FloatController.Curve = new MMTweenType(MMTween.MMTweenCurve.EaseInCubic)

the curve to apply to the tween

◆ DisableAfterOneTime

bool MoreMountains.Tools.FloatController.DisableAfterOneTime

whether or not this controller should go to sleep after a one time shake

◆ DisableAfterToDestination

bool MoreMountains.Tools.FloatController.DisableAfterToDestination

whether or not this controller should go to sleep after a to destination shake

◆ DisableGameObjectAfterOneTime

bool MoreMountains.Tools.FloatController.DisableGameObjectAfterOneTime = false

whether or not this controller should go back to sleep after a OneTime

◆ DrivenLevel

float MoreMountains.Tools.FloatController.DrivenLevel = 0f

the value that will be applied to the controlled float in driven mode

◆ Duration

float MoreMountains.Tools.FloatController.Duration = 1f

the duration of one ping (or pong)

◆ Frequency

Vector2 MoreMountains.Tools.FloatController.Frequency = new Vector2(1f, 1f)

the noise frequency

◆ InitialValue

float MoreMountains.Tools.FloatController.InitialValue

the initial value of the controlled float

◆ MaxValue

float MoreMountains.Tools.FloatController.MaxValue = 5f

the maximum value for the ping pong

◆ MinValue

float MoreMountains.Tools.FloatController.MinValue = 0f

the minimum value for the ping pong

◆ NormalizedLevelID

int MoreMountains.Tools.FloatController.NormalizedLevelID = 0

when in NormalizedBufferedBandLevels

◆ OneTimeAmplitude

float MoreMountains.Tools.FloatController.OneTimeAmplitude = 1f

the amplitude of the One Time shake (this will be multiplied by the curve's height)

◆ OneTimeButton

bool MoreMountains.Tools.FloatController.OneTimeButton

a test button for the one time shake

◆ OneTimeCurve

AnimationCurve MoreMountains.Tools.FloatController.OneTimeCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0))

the curve to apply to the one time shake

◆ OneTimeDuration

float MoreMountains.Tools.FloatController.OneTimeDuration = 1f

the duration of the One Time shake

◆ OneTimeRemapMax

float MoreMountains.Tools.FloatController.OneTimeRemapMax = 1f

the high value to remap the normalized curve value to

◆ OneTimeRemapMin

float MoreMountains.Tools.FloatController.OneTimeRemapMin = 0f

the low value to remap the normalized curve value to

◆ PingPong

float MoreMountains.Tools.FloatController.PingPong

internal use only

◆ PingPongPauseDuration

float MoreMountains.Tools.FloatController.PingPongPauseDuration = 0f

the duration (in seconds) between a ping and a pong

◆ PropertyName

string MoreMountains.Tools.FloatController.PropertyName

internal use only

◆ RemapNoiseOne

float MoreMountains.Tools.FloatController.RemapNoiseOne = 1f

the value to which to remap the random's one bound

◆ RemapNoiseValues

bool MoreMountains.Tools.FloatController.RemapNoiseValues = false

if this is true, will let you remap the noise value (without amplitude) to the bounds you've specified

◆ RemapNoiseZero

float MoreMountains.Tools.FloatController.RemapNoiseZero = 0f

the value to which to remap the random's zero bound

◆ RevertToInitialValueAfterEnd

bool MoreMountains.Tools.FloatController.RevertToInitialValueAfterEnd = true

whether or not you want to revert to the InitialValue after the control ends

◆ Shift

Vector2 MoreMountains.Tools.FloatController.Shift = new Vector2(0f, 1f)

the noise shift

◆ TargetAttribute

MonoAttribute MoreMountains.Tools.FloatController.TargetAttribute

internal use only

◆ TargetObject

MonoBehaviour MoreMountains.Tools.FloatController.TargetObject

the mono on which the float you want to control is

◆ ToDestinationButton

bool MoreMountains.Tools.FloatController.ToDestinationButton

a test button for the one time shake

◆ ToDestinationCurve

AnimationCurve MoreMountains.Tools.FloatController.ToDestinationCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 0.6f), new Keyframe(1f, 1f))

the curve to use when tweening a value to destination

◆ ToDestinationDuration

float MoreMountains.Tools.FloatController.ToDestinationDuration = 1f

the duration of the tween to the destination value

◆ ToDestinationValue

float MoreMountains.Tools.FloatController.ToDestinationValue = 1f

the value to tween to

◆ UseUnscaledTime

bool MoreMountains.Tools.FloatController.UseUnscaledTime = true

whether or not to use unscaled time


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