Highroad Engine v1.3
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MoreMountains.Tools.ShaderController 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.ShaderController:
MoreMountains.Tools.MMMonoBehaviour

Public Types

enum  TargetTypes { Renderer , Image , RawImage , Text }
 the possible types of targets More...
 
enum  PropertyTypes {
  Bool , Float , Int , Vector ,
  Keyword , Color
}
 the possible types of properties More...
 
enum  ControlModes {
  PingPong , Random , OneTime , AudioAnalyzer ,
  ToDestination , Driven
}
 the possible control modes More...
 

Public Member Functions

virtual bool FindShaderProperty (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 shader controller More...
 
virtual void ToDestination ()
 Triggers a one time shake of the controller to a specified destination value More...
 
void SetFromColor (Color newColor)
 Use this method to change the FromColor value More...
 
void SetToColor (Color newColor)
 Use this method to change the ToColor value More...
 
virtual void SetRemapOneTimeMin (float newValue)
 Use this method to change the OneTimeRemapMin value More...
 
virtual void SetRemapOneTimeMax (float newValue)
 Use this method to change the OneTimeRemapMax value More...
 
virtual void SetToDestinationValue (float newValue)
 Use this method to change the ToDestinationValue More...
 
virtual void Stop ()
 Interrupts any tween in progress, and disables itself More...
 

Public Attributes

TargetTypes TargetType = TargetTypes.Renderer
 the type of renderer to pilot More...
 
Renderer TargetRenderer
 the renderer with the shader you want to control More...
 
int TargetMaterialID = 0
 the ID of the material in the Materials array on the target renderer (usually 0) More...
 
Image TargetImage
 the Image with the shader you want to control More...
 
bool UseMaterialForRendering = false
 if this is true, the 'materialForRendering' for this Image will be used, instead of the regular material More...
 
RawImage TargetRawImage
 the RawImage with the shader you want to control More...
 
Text TargetText
 the Text with the shader you want to control More...
 
bool CacheMaterial = true
 if this is true, material will be cached on Start More...
 
bool CreateMaterialInstance = false
 if this is true, an instance of the material will be created on start so that this controller only affects its target More...
 
string TargetPropertyName
 the EXACT name of the property to affect More...
 
PropertyTypes PropertyType = PropertyTypes.Float
 the type of the property to affect More...
 
bool X
 whether or not to affect its x component More...
 
bool Y
 whether or not to affect its y component More...
 
bool Z
 whether or not to affect its z component More...
 
bool W
 whether or not to affect its w component More...
 
Color FromColor = Color.black
 the color to lerp from
More...
 
Color ToColor = Color.white
 the color to lerp to
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...
 
bool UseMaterialPropertyBlocks = false
 if this is true, this component will use material property blocks instead of working on an instance of the material. More...
 
bool SafeMode = false
 whether or not to perform extra safety checks (safer, more costly) More...
 
MMTweenType Curve
 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 = 1f
 the duration of the pause between two ping (or pongs) (in seconds) More...
 
float DrivenLevel = 0f
 the value that will be applied to the controlled float in driven mode 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 OneTimeButton
 a test button for the one time shake More...
 
bool DisableAfterOneTime = false
 whether or not this controller should go back to sleep after a OneTime More...
 
bool DisableGameObjectAfterOneTime = false
 whether or not this controller should go back to sleep after a OneTime More...
 
MMAudioAnalyzer AudioAnalyzer
 the bound audio analyzer used to drive this controller More...
 
int BeatID
 the ID of the selected beat on the analyzer More...
 
float AudioAnalyzerMultiplier = 1f
 the multiplier to apply to the value out of the analyzer More...
 
float AudioAnalyzerOffset = 0f
 the offset to apply to the value out of the analyzer More...
 
float AudioAnalyzerLerp = 60f
 the speed at which to lerp the value More...
 
float ToDestinationValue = 1f
 the value to go to when in ToDestination mode More...
 
float ToDestinationDuration = 1f
 the duration of the ToDestination tween More...
 
AnimationCurve ToDestinationCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(0.5f, 0.6f), new Keyframe(1f, 1f))
 the curve to use to tween to the ToDestination value More...
 
bool ToDestinationButton
 a test button for the one time shake More...
 
bool DisableAfterToDestination = false
 whether or not this controller should go back to sleep after a OneTime More...
 
float InitialValue
 the initial value of the controlled float More...
 
float CurrentValue
 the current value of the controlled float More...
 
float CurrentValueNormalized = 0f
 the current value of the controlled float, normalized More...
 
Color InitialColor
 the current value of the controlled float
More...
 
int PropertyID
 the ID of the property More...
 
bool PropertyFound = false
 whether or not the property got found More...
 
Material TargetMaterial
 the target material More...
 
float PingPong
 internal use only More...
 

Protected Member Functions

virtual void Awake ()
 On start we initialize our controller More...
 
virtual void OnEnable ()
 On enable, grabs the initial value More...
 
virtual bool RendererIsNull ()
 Returns true if the renderer is null, false otherwise 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 OnDisable ()
 
virtual void UpdateValue ()
 Updates the value over time based on the selected options More...
 
virtual float GetInitialValue ()
 Grabs and stores the initial value More...
 
virtual void SetValue (float newValue)
 Sets the value in the shader More...
 

Protected Attributes

float _randomAmplitude
 
float _randomFrequency
 
float _randomShift
 
float _elapsedTime = 0f
 
bool _shaking = false
 
float _startedTimestamp = 0f
 
float _remappedTimeSinceStart = 0f
 
Color _currentColor
 
Vector4 _vectorValue
 
float _pingPongDirection = 1f
 
float _lastPingPongPauseAt = 0f
 
float _initialValue = 0f
 
Color _fromColorStorage
 
bool _activeLastFrame = false
 
MaterialPropertyBlock _propertyBlock
 

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

◆ ControlModes

the possible control modes

Enumerator
PingPong 
Random 
OneTime 
AudioAnalyzer 
ToDestination 
Driven 

◆ PropertyTypes

the possible types of properties

Enumerator
Bool 
Float 
Int 
Vector 
Keyword 
Color 

◆ TargetTypes

the possible types of targets

Enumerator
Renderer 
Image 
RawImage 
Text 

Member Function Documentation

◆ Awake()

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

On start we initialize our controller

◆ FindShaderProperty()

virtual bool MoreMountains.Tools.ShaderController.FindShaderProperty ( string  propertyName)
virtual

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

Parameters
propertyName
Returns

◆ GetDeltaTime()

float MoreMountains.Tools.ShaderController.GetDeltaTime ( )
protected

Returns the relevant delta time

Returns

◆ GetInitialValue()

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

Grabs and stores the initial value

◆ GetTime()

float MoreMountains.Tools.ShaderController.GetTime ( )
protected

Returns the relevant time

Returns

◆ Initialization()

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

Grabs the target property and initializes stuff

◆ OnDisable()

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

◆ OnEnable()

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

On enable, grabs the initial value

◆ OneTime()

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

Triggers a one time shake of the shader controller

◆ RendererIsNull()

virtual bool MoreMountains.Tools.ShaderController.RendererIsNull ( )
protectedvirtual

Returns true if the renderer is null, false otherwise

Returns

◆ SetDrivenLevelAbsolute()

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

Sets the level to the value passed in parameters

Parameters
level

◆ SetDrivenLevelNormalized()

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

Sets the level to the remapped value passed in parameters

Parameters
normalizedLevel
remapZero
remapOne

◆ SetFromColor()

void MoreMountains.Tools.ShaderController.SetFromColor ( Color  newColor)

Use this method to change the FromColor value

Parameters
newColor

◆ SetRemapOneTimeMax()

virtual void MoreMountains.Tools.ShaderController.SetRemapOneTimeMax ( float  newValue)
virtual

Use this method to change the OneTimeRemapMax value

Parameters
newValue

◆ SetRemapOneTimeMin()

virtual void MoreMountains.Tools.ShaderController.SetRemapOneTimeMin ( float  newValue)
virtual

Use this method to change the OneTimeRemapMin value

Parameters
newValue

◆ SetToColor()

void MoreMountains.Tools.ShaderController.SetToColor ( Color  newColor)

Use this method to change the ToColor value

Parameters
newColor

◆ SetToDestinationValue()

virtual void MoreMountains.Tools.ShaderController.SetToDestinationValue ( float  newValue)
virtual

Use this method to change the ToDestinationValue

Parameters
newValue

◆ SetValue()

virtual void MoreMountains.Tools.ShaderController.SetValue ( float  newValue)
protectedvirtual

Sets the value in the shader

Parameters
newValue

◆ Stop()

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

Interrupts any tween in progress, and disables itself

◆ ToDestination()

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

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

◆ Update()

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

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

◆ UpdateValue()

virtual void MoreMountains.Tools.ShaderController.UpdateValue ( )
protectedvirtual

Updates the value over time based on the selected options

Member Data Documentation

◆ _activeLastFrame

bool MoreMountains.Tools.ShaderController._activeLastFrame = false
protected

◆ _currentColor

Color MoreMountains.Tools.ShaderController._currentColor
protected

◆ _elapsedTime

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

◆ _fromColorStorage

Color MoreMountains.Tools.ShaderController._fromColorStorage
protected

◆ _initialValue

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

◆ _lastPingPongPauseAt

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

◆ _pingPongDirection

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

◆ _propertyBlock

MaterialPropertyBlock MoreMountains.Tools.ShaderController._propertyBlock
protected

◆ _randomAmplitude

float MoreMountains.Tools.ShaderController._randomAmplitude
protected

◆ _randomFrequency

float MoreMountains.Tools.ShaderController._randomFrequency
protected

◆ _randomShift

float MoreMountains.Tools.ShaderController._randomShift
protected

◆ _remappedTimeSinceStart

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

◆ _shaking

bool MoreMountains.Tools.ShaderController._shaking = false
protected

◆ _startedTimestamp

float MoreMountains.Tools.ShaderController._startedTimestamp = 0f
protected

◆ _vectorValue

Vector4 MoreMountains.Tools.ShaderController._vectorValue
protected

◆ AddToInitialValue

bool MoreMountains.Tools.ShaderController.AddToInitialValue = false

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

◆ Amplitude

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

the noise amplitude

◆ AudioAnalyzer

MMAudioAnalyzer MoreMountains.Tools.ShaderController.AudioAnalyzer

the bound audio analyzer used to drive this controller

◆ AudioAnalyzerLerp

float MoreMountains.Tools.ShaderController.AudioAnalyzerLerp = 60f

the speed at which to lerp the value

◆ AudioAnalyzerMultiplier

float MoreMountains.Tools.ShaderController.AudioAnalyzerMultiplier = 1f

the multiplier to apply to the value out of the analyzer

◆ AudioAnalyzerOffset

float MoreMountains.Tools.ShaderController.AudioAnalyzerOffset = 0f

the offset to apply to the value out of the analyzer

◆ BeatID

int MoreMountains.Tools.ShaderController.BeatID

the ID of the selected beat on the analyzer

◆ CacheMaterial

bool MoreMountains.Tools.ShaderController.CacheMaterial = true

if this is true, material will be cached on Start

◆ ControlMode

ControlModes MoreMountains.Tools.ShaderController.ControlMode

the control mode (ping pong or random)

◆ CreateMaterialInstance

bool MoreMountains.Tools.ShaderController.CreateMaterialInstance = false

if this is true, an instance of the material will be created on start so that this controller only affects its target

◆ CurrentValue

float MoreMountains.Tools.ShaderController.CurrentValue

the current value of the controlled float

◆ CurrentValueNormalized

float MoreMountains.Tools.ShaderController.CurrentValueNormalized = 0f

the current value of the controlled float, normalized

◆ Curve

MMTweenType MoreMountains.Tools.ShaderController.Curve

the curve to apply to the tween

◆ DisableAfterOneTime

bool MoreMountains.Tools.ShaderController.DisableAfterOneTime = false

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

◆ DisableAfterToDestination

bool MoreMountains.Tools.ShaderController.DisableAfterToDestination = false

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

◆ DisableGameObjectAfterOneTime

bool MoreMountains.Tools.ShaderController.DisableGameObjectAfterOneTime = false

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

◆ DrivenLevel

float MoreMountains.Tools.ShaderController.DrivenLevel = 0f

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

◆ Duration

float MoreMountains.Tools.ShaderController.Duration = 1f

the duration of one ping (or pong)

◆ Frequency

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

the noise frequency

◆ FromColor

Color MoreMountains.Tools.ShaderController.FromColor = Color.black

the color to lerp from

◆ InitialColor

Color MoreMountains.Tools.ShaderController.InitialColor

the current value of the controlled float

◆ InitialValue

float MoreMountains.Tools.ShaderController.InitialValue

the initial value of the controlled float

◆ MaxValue

float MoreMountains.Tools.ShaderController.MaxValue = 5f

the maximum value for the ping pong

◆ MinValue

float MoreMountains.Tools.ShaderController.MinValue = 0f

the minimum value for the ping pong

◆ OneTimeAmplitude

float MoreMountains.Tools.ShaderController.OneTimeAmplitude = 1f

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

◆ OneTimeButton

bool MoreMountains.Tools.ShaderController.OneTimeButton

a test button for the one time shake

◆ OneTimeCurve

AnimationCurve MoreMountains.Tools.ShaderController.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.ShaderController.OneTimeDuration = 1f

the duration of the One Time shake

◆ OneTimeRemapMax

float MoreMountains.Tools.ShaderController.OneTimeRemapMax = 1f

the high value to remap the normalized curve value to

◆ OneTimeRemapMin

float MoreMountains.Tools.ShaderController.OneTimeRemapMin = 0f

the low value to remap the normalized curve value to

◆ PingPong

float MoreMountains.Tools.ShaderController.PingPong

internal use only

◆ PingPongPauseDuration

float MoreMountains.Tools.ShaderController.PingPongPauseDuration = 1f

the duration of the pause between two ping (or pongs) (in seconds)

◆ PropertyFound

bool MoreMountains.Tools.ShaderController.PropertyFound = false

whether or not the property got found

◆ PropertyID

int MoreMountains.Tools.ShaderController.PropertyID

the ID of the property

◆ PropertyType

PropertyTypes MoreMountains.Tools.ShaderController.PropertyType = PropertyTypes.Float

the type of the property to affect

◆ RemapNoiseOne

float MoreMountains.Tools.ShaderController.RemapNoiseOne = 1f

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

◆ RemapNoiseValues

bool MoreMountains.Tools.ShaderController.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.ShaderController.RemapNoiseZero = 0f

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

◆ RevertToInitialValueAfterEnd

bool MoreMountains.Tools.ShaderController.RevertToInitialValueAfterEnd = true

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

◆ SafeMode

bool MoreMountains.Tools.ShaderController.SafeMode = false

whether or not to perform extra safety checks (safer, more costly)

◆ Shift

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

the noise shift

◆ TargetImage

Image MoreMountains.Tools.ShaderController.TargetImage

the Image with the shader you want to control

◆ TargetMaterial

Material MoreMountains.Tools.ShaderController.TargetMaterial

the target material

◆ TargetMaterialID

int MoreMountains.Tools.ShaderController.TargetMaterialID = 0

the ID of the material in the Materials array on the target renderer (usually 0)

◆ TargetPropertyName

string MoreMountains.Tools.ShaderController.TargetPropertyName

the EXACT name of the property to affect

◆ TargetRawImage

RawImage MoreMountains.Tools.ShaderController.TargetRawImage

the RawImage with the shader you want to control

◆ TargetRenderer

Renderer MoreMountains.Tools.ShaderController.TargetRenderer

the renderer with the shader you want to control

◆ TargetText

Text MoreMountains.Tools.ShaderController.TargetText

the Text with the shader you want to control

◆ TargetType

TargetTypes MoreMountains.Tools.ShaderController.TargetType = TargetTypes.Renderer

the type of renderer to pilot

◆ ToColor

Color MoreMountains.Tools.ShaderController.ToColor = Color.white

the color to lerp to

◆ ToDestinationButton

bool MoreMountains.Tools.ShaderController.ToDestinationButton

a test button for the one time shake

◆ ToDestinationCurve

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

the curve to use to tween to the ToDestination value

◆ ToDestinationDuration

float MoreMountains.Tools.ShaderController.ToDestinationDuration = 1f

the duration of the ToDestination tween

◆ ToDestinationValue

float MoreMountains.Tools.ShaderController.ToDestinationValue = 1f

the value to go to when in ToDestination mode

◆ UseMaterialForRendering

bool MoreMountains.Tools.ShaderController.UseMaterialForRendering = false

if this is true, the 'materialForRendering' for this Image will be used, instead of the regular material

◆ UseMaterialPropertyBlocks

bool MoreMountains.Tools.ShaderController.UseMaterialPropertyBlocks = false

if this is true, this component will use material property blocks instead of working on an instance of the material.

◆ UseUnscaledTime

bool MoreMountains.Tools.ShaderController.UseUnscaledTime = true

whether or not to use unscaled time

◆ W

bool MoreMountains.Tools.ShaderController.W

whether or not to affect its w component

◆ X

bool MoreMountains.Tools.ShaderController.X

whether or not to affect its x component

◆ Y

bool MoreMountains.Tools.ShaderController.Y

whether or not to affect its y component

◆ Z

bool MoreMountains.Tools.ShaderController.Z

whether or not to affect its z component


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