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

You can add this class to a slider in your UI and it'll let you control a target Track volume via the MMSoundManager More...

Inheritance diagram for MoreMountains.Tools.MMSoundManagerTrackVolumeSlider:
MoreMountains.Tools.MMEventListener< MMSoundManagerEvent > MoreMountains.Tools.MMEventListener< MMSoundManagerTrackEvent > MoreMountains.Tools.MMEventListener< MMSoundManagerTrackFadeEvent >

Public Types

enum  Modes { Modes.Read, Modes.Write }
 The possible modes this slider can be in More...
 

Public Member Functions

virtual void ChangeModeToRead (float duration)
 A public method you can use to switch to read mode for a limited time, resetting to write after that More...
 
virtual void UpdateVolume (float newValue)
 Bind your slider to this method More...
 
void OnMMEvent (MMSoundManagerEvent soundManagerEvent)
 When we get an event letting us know the settings have been loaded, we update our slider to reflect the current track volume More...
 
virtual void UpdateSliderValueWithTrackVolume ()
 Updates the slider value to reflect the current track volume More...
 
void OnMMEvent (MMSoundManagerTrackEvent trackEvent)
 if we grab a track event, we switch to read mode if needed More...
 
void OnMMEvent (MMSoundManagerTrackFadeEvent fadeEvent)
 if we grab a track fade event, we switch to read mode if needed More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMSoundManagerEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMSoundManagerTrackEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMSoundManagerTrackFadeEvent >
void OnMMEvent (T eventType)
 

Public Attributes

MMSoundManager.MMSoundManagerTracks Track
 The track to change volume on. More...
 
float MinVolume = 0f
 The volume to apply to the track when the slider is at its minimum. More...
 
float MaxVolume = 1f
 The volume to apply to the track when the slider is at its maximum. More...
 
Modes Mode = Modes.Write
 in read mode, the value of the slider will be applied to the volume of the track. in read mode, the slider will move to reflect the volume of the track More...
 
bool ChangeModeOnTrackFade = true
 if this is true, the slider will automatically switch to read mode for the required duration when a track fade event is caught More...
 
bool ChangeModeOnMute = true
 if this is true, the slider will automatically switch to read mode for the required duration when a track mute event is caught More...
 
bool ChangeModeOnUnmute = true
 if this is true, the slider will automatically switch to read mode for the required duration when a track unmute event is caught More...
 
bool ChangeModeOnTrackVolumeChange = false
 if this is true, the slider will automatically switch to read mode for the required duration when a track volume change event is caught More...
 
float ModeSwitchBufferTime = 0.1f
 when switching automatically (and temporarily) to Read Mode, the minimum duration the slider will remain in that mode More...
 

Protected Member Functions

virtual void Awake ()
 On awake we cache our slider More...
 
virtual void LateUpdate ()
 On late update, we update our slider's value if in read mode, and reset our mode if needed More...
 
virtual void OnEnable ()
 On enable we start listening for events More...
 
virtual void OnDisable ()
 On disable we stop listening for events More...
 

Protected Attributes

Slider _slider
 
Modes _resetToMode
 
bool _resetNeeded = false
 
float _resetTimestamp
 

Detailed Description

You can add this class to a slider in your UI and it'll let you control a target Track volume via the MMSoundManager

Member Enumeration Documentation

◆ Modes

The possible modes this slider can be in

  • Read : the slider will move to reflect the volume of the track
  • Write : the value of the slider will be applied to the volume of the track This slider can also listen for events (mute, unmute, fade, volume change) and automatically switch to read mode if one is caught. This means that most of the time, the slider is in write mode, and switches to read mode only when needed, to be always accurate
Enumerator
Read 
Write 

Member Function Documentation

◆ Awake()

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

On awake we cache our slider

◆ ChangeModeToRead()

virtual void MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.ChangeModeToRead ( float  duration)
virtual

A public method you can use to switch to read mode for a limited time, resetting to write after that

Parameters
duration

◆ LateUpdate()

virtual void MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.LateUpdate ( )
protectedvirtual

On late update, we update our slider's value if in read mode, and reset our mode if needed

◆ OnDisable()

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

On disable we stop listening for events

◆ OnEnable()

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

On enable we start listening for events

◆ OnMMEvent() [1/3]

void MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.OnMMEvent ( MMSoundManagerEvent  soundManagerEvent)

When we get an event letting us know the settings have been loaded, we update our slider to reflect the current track volume

Parameters
soundManagerEvent

◆ OnMMEvent() [2/3]

void MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.OnMMEvent ( MMSoundManagerTrackEvent  trackEvent)

if we grab a track event, we switch to read mode if needed

Parameters
trackEvent

◆ OnMMEvent() [3/3]

void MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.OnMMEvent ( MMSoundManagerTrackFadeEvent  fadeEvent)

if we grab a track fade event, we switch to read mode if needed

Parameters
fadeEvent

◆ UpdateSliderValueWithTrackVolume()

virtual void MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.UpdateSliderValueWithTrackVolume ( )
virtual

Updates the slider value to reflect the current track volume

◆ UpdateVolume()

virtual void MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.UpdateVolume ( float  newValue)
virtual

Bind your slider to this method

Member Data Documentation

◆ _resetNeeded

bool MoreMountains.Tools.MMSoundManagerTrackVolumeSlider._resetNeeded = false
protected

◆ _resetTimestamp

float MoreMountains.Tools.MMSoundManagerTrackVolumeSlider._resetTimestamp
protected

◆ _resetToMode

Modes MoreMountains.Tools.MMSoundManagerTrackVolumeSlider._resetToMode
protected

◆ _slider

Slider MoreMountains.Tools.MMSoundManagerTrackVolumeSlider._slider
protected

◆ ChangeModeOnMute

bool MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.ChangeModeOnMute = true

if this is true, the slider will automatically switch to read mode for the required duration when a track mute event is caught

◆ ChangeModeOnTrackFade

bool MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.ChangeModeOnTrackFade = true

if this is true, the slider will automatically switch to read mode for the required duration when a track fade event is caught

◆ ChangeModeOnTrackVolumeChange

bool MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.ChangeModeOnTrackVolumeChange = false

if this is true, the slider will automatically switch to read mode for the required duration when a track volume change event is caught

◆ ChangeModeOnUnmute

bool MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.ChangeModeOnUnmute = true

if this is true, the slider will automatically switch to read mode for the required duration when a track unmute event is caught

◆ MaxVolume

float MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.MaxVolume = 1f

The volume to apply to the track when the slider is at its maximum.

◆ MinVolume

float MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.MinVolume = 0f

The volume to apply to the track when the slider is at its minimum.

◆ Mode

Modes MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.Mode = Modes.Write

in read mode, the value of the slider will be applied to the volume of the track. in read mode, the slider will move to reflect the volume of the track

◆ ModeSwitchBufferTime

float MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.ModeSwitchBufferTime = 0.1f

when switching automatically (and temporarily) to Read Mode, the minimum duration the slider will remain in that mode

◆ Track

MMSoundManager.MMSoundManagerTracks MoreMountains.Tools.MMSoundManagerTrackVolumeSlider.Track

The track to change volume on.


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