MMFeedbacks  v1.6
Public Types | Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
MoreMountains.Feedbacks.MMFeedbackSound Class Reference
Inheritance diagram for MoreMountains.Feedbacks.MMFeedbackSound:
MoreMountains.Feedbacks.MMFeedback

Public Types

enum  PlayMethods { PlayMethods.Event, PlayMethods.Cached, PlayMethods.OnDemand, PlayMethods.Pool }
 sets the inspector color for this feedback More...
 

Public Attributes

AudioClip Sfx
 the sound clip to play More...
 
AudioClip[] RandomSfx
 an array to pick a random sfx from More...
 
bool TestButton
 
bool TestStopButton
 
PlayMethods PlayMethod = PlayMethods.Event
 the play method to use when playing the sound (event, cached or on demand) More...
 
int PoolSize = 10
 
float MinVolume = 1f
 the minimum volume to play the sound at More...
 
float MaxVolume = 1f
 the maximum volume to play the sound at More...
 
float MinPitch = 1f
 the minimum pitch to play the sound at More...
 
float MaxPitch = 1f
 the maximum pitch to play the sound at More...
 
AudioMixerGroup SfxAudioMixerGroup
 the audiomixer to play the sound with (optional) More...
 
- Public Attributes inherited from MoreMountains.Feedbacks.MMFeedback
bool Active = true
 whether or not this feedback is active More...
 
string Label = "MMFeedback"
 the name of this feedback to display in the inspector More...
 
float Chance = 100f
 the chance of this feedback happening (in percent : 100 : happens all the time, 0 : never happens, 50 : happens once every two calls, etc) More...
 
MMFeedbackTiming Timing
 a number of timing-related values (delay, repeat, etc) More...
 
bool DebugActive = false
 whether or not this feedback is in debug mode More...
 

Protected Member Functions

override void CustomInitialization (GameObject owner)
 Custom init to cache the audiosource if required More...
 
virtual AudioSource CreateAudioSource (GameObject owner, string audioSourceName)
 
override void CustomPlayFeedback (Vector3 position, float attenuation=1.0f)
 Plays either a random sound or the specified sfx More...
 
virtual void PlaySound (AudioClip sfx, Vector3 position)
 Plays a sound differently based on the selected play method More...
 
virtual void PlayAudioSource (AudioSource audioSource, AudioClip sfx, float volume, float pitch, AudioMixerGroup audioMixerGroup=null)
 Plays the audio source with the specified volume and pitch More...
 
virtual AudioSource GetAudioSourceFromPool ()
 Gets an audio source from the pool if possible More...
 
virtual async void TestPlaySound ()
 A test method that creates an audiosource, plays it, and destroys itself after play More...
 
virtual void TestStopSound ()
 A test method that stops the test sound More...
 
- Protected Member Functions inherited from MoreMountains.Feedbacks.MMFeedback
virtual IEnumerator PlayCoroutine (Vector3 position, float attenuation=1.0f)
 An internal coroutine delaying the initial play of the feedback More...
 
virtual void RegularPlay (Vector3 position, float attenuation=1.0f)
 Triggers delaying coroutines if needed More...
 
virtual IEnumerator InfinitePlay (Vector3 position, float attenuation=1.0f)
 Internal coroutine used for repeated play without end More...
 
virtual IEnumerator RepeatedPlay (Vector3 position, float attenuation=1.0f)
 Internal coroutine used for repeated play More...
 
virtual IEnumerator SequenceCoroutine (Vector3 position, float attenuation=1.0f)
 A coroutine used to play this feedback on a sequence More...
 
virtual void CustomStopFeedback (Vector3 position, float attenuation=1.0f)
 This method describes what happens when the feedback gets stopped More...
 
virtual void CustomReset ()
 This method describes what happens when the feedback gets reset More...
 

Protected Attributes

AudioClip _randomClip
 
AudioSource _cachedAudioSource
 
AudioSource[] _pool
 
AudioSource _tempAudioSource
 
float _duration
 
AudioSource _editorAudioSource
 
- Protected Attributes inherited from MoreMountains.Feedbacks.MMFeedback
WaitForSeconds _initialDelayWaitForSeconds
 
WaitForSeconds _betweenDelayWaitForSeconds
 
WaitForSeconds _sequenceDelayWaitForSeconds
 
float _lastPlayTimestamp = -1f
 
int _playsLeft
 
bool _initialized = false
 
Coroutine _playCoroutine
 
Coroutine _infinitePlayCoroutine
 
Coroutine _sequenceCoroutine
 
Coroutine _repeatedPlayCoroutine
 
int _sequenceTrackID = 0
 
float _beatInterval
 
bool BeatThisFrame = false
 
int LastBeatIndex = 0
 
int CurrentSequenceIndex = 0
 
float LastBeatTimestamp = 0f
 

Properties

override float FeedbackDuration [get]
 the duration of this feedback is the duration of the clip being played More...
 
- Properties inherited from MoreMountains.Feedbacks.MMFeedback
GameObject Owner [get, set]
 the Owner of the feedback, as defined when calling the Initialization method More...
 
virtual YieldInstruction Pause [get]
 set this to true if your feedback should pause the execution of the feedback sequence More...
 
virtual bool HoldingPause [get]
 if this is true, this feedback will wait until all previous feedbacks have run More...
 
virtual bool LooperPause [get]
 if this is true, this feedback will wait until all previous feedbacks have run, then run all previous feedbacks again More...
 
virtual bool LooperStart [get]
 if this is true, this feedback will wait until all previous feedbacks have run, then run all previous feedbacks again More...
 
virtual bool InCooldown [get]
 returns true if this feedback is in cooldown at this time (and thus can't play), false otherwise More...
 
float FeedbackTime [get]
 the time (or unscaled time) based on the selected Timing settings More...
 
float FeedbackDeltaTime [get]
 the delta time (or unscaled delta time) based on the selected Timing settings More...
 
virtual float FeedbackStartedAt [get]
 
virtual float FeedbackDuration [get]
 
virtual bool FeedbackPlaying [get]
 whether or not this feedback is playing right now More...
 

Additional Inherited Members

- Public Member Functions inherited from MoreMountains.Feedbacks.MMFeedback
virtual void Initialization (GameObject owner)
 Initializes the feedback and its timing related variables More...
 
virtual void Play (Vector3 position, float attenuation=1.0f)
 Plays the feedback More...
 
virtual void Stop (Vector3 position, float attenuation=1.0f)
 Stops all feedbacks from playing. Will stop repeating feedbacks, and call custom stop implementations More...
 
virtual void ResetFeedback ()
 Calls this feedback's custom reset More...
 
virtual void SetSequence (MMSequence newSequence)
 Use this method to change this feedback's sequence at runtime More...
 
virtual void SetDelayBetweenRepeats (float delay)
 Use this method to specify a new delay between repeats at runtime More...
 
virtual void SetInitialDelay (float delay)
 Use this method to specify a new initial delay at runtime More...
 

Member Enumeration Documentation

◆ PlayMethods

sets the inspector color for this feedback

The possible methods to play the sound with. Event : sends a MMSfxEvent, you'll need a class to catch this event and play the sound Cached : creates and stores an audiosource to play the sound with, parented to the owner OnDemand : creates an audiosource and destroys it everytime you want to play the sound

Enumerator
Event 
Cached 
OnDemand 
Pool 

Member Function Documentation

◆ CreateAudioSource()

virtual AudioSource MoreMountains.Feedbacks.MMFeedbackSound.CreateAudioSource ( GameObject  owner,
string  audioSourceName 
)
protectedvirtual

◆ CustomInitialization()

override void MoreMountains.Feedbacks.MMFeedbackSound.CustomInitialization ( GameObject  owner)
protectedvirtual

Custom init to cache the audiosource if required

Parameters
owner

Reimplemented from MoreMountains.Feedbacks.MMFeedback.

◆ CustomPlayFeedback()

override void MoreMountains.Feedbacks.MMFeedbackSound.CustomPlayFeedback ( Vector3  position,
float  attenuation = 1.0f 
)
protectedvirtual

Plays either a random sound or the specified sfx

Parameters
position
attenuation

Implements MoreMountains.Feedbacks.MMFeedback.

◆ GetAudioSourceFromPool()

virtual AudioSource MoreMountains.Feedbacks.MMFeedbackSound.GetAudioSourceFromPool ( )
protectedvirtual

Gets an audio source from the pool if possible

Returns

◆ PlayAudioSource()

virtual void MoreMountains.Feedbacks.MMFeedbackSound.PlayAudioSource ( AudioSource  audioSource,
AudioClip  sfx,
float  volume,
float  pitch,
AudioMixerGroup  audioMixerGroup = null 
)
protectedvirtual

Plays the audio source with the specified volume and pitch

Parameters
audioSource
sfx
volume
pitch

◆ PlaySound()

virtual void MoreMountains.Feedbacks.MMFeedbackSound.PlaySound ( AudioClip  sfx,
Vector3  position 
)
protectedvirtual

Plays a sound differently based on the selected play method

Parameters
sfx
position

◆ TestPlaySound()

virtual async void MoreMountains.Feedbacks.MMFeedbackSound.TestPlaySound ( )
protectedvirtual

A test method that creates an audiosource, plays it, and destroys itself after play

◆ TestStopSound()

virtual void MoreMountains.Feedbacks.MMFeedbackSound.TestStopSound ( )
protectedvirtual

A test method that stops the test sound

Member Data Documentation

◆ _cachedAudioSource

AudioSource MoreMountains.Feedbacks.MMFeedbackSound._cachedAudioSource
protected

◆ _duration

float MoreMountains.Feedbacks.MMFeedbackSound._duration
protected

◆ _editorAudioSource

AudioSource MoreMountains.Feedbacks.MMFeedbackSound._editorAudioSource
protected

◆ _pool

AudioSource [] MoreMountains.Feedbacks.MMFeedbackSound._pool
protected

◆ _randomClip

AudioClip MoreMountains.Feedbacks.MMFeedbackSound._randomClip
protected

◆ _tempAudioSource

AudioSource MoreMountains.Feedbacks.MMFeedbackSound._tempAudioSource
protected

◆ MaxPitch

float MoreMountains.Feedbacks.MMFeedbackSound.MaxPitch = 1f

the maximum pitch to play the sound at

◆ MaxVolume

float MoreMountains.Feedbacks.MMFeedbackSound.MaxVolume = 1f

the maximum volume to play the sound at

◆ MinPitch

float MoreMountains.Feedbacks.MMFeedbackSound.MinPitch = 1f

the minimum pitch to play the sound at

◆ MinVolume

float MoreMountains.Feedbacks.MMFeedbackSound.MinVolume = 1f

the minimum volume to play the sound at

◆ PlayMethod

PlayMethods MoreMountains.Feedbacks.MMFeedbackSound.PlayMethod = PlayMethods.Event

the play method to use when playing the sound (event, cached or on demand)

◆ PoolSize

int MoreMountains.Feedbacks.MMFeedbackSound.PoolSize = 10

◆ RandomSfx

AudioClip [] MoreMountains.Feedbacks.MMFeedbackSound.RandomSfx

an array to pick a random sfx from

◆ Sfx

AudioClip MoreMountains.Feedbacks.MMFeedbackSound.Sfx

the sound clip to play

◆ SfxAudioMixerGroup

AudioMixerGroup MoreMountains.Feedbacks.MMFeedbackSound.SfxAudioMixerGroup

the audiomixer to play the sound with (optional)

◆ TestButton

bool MoreMountains.Feedbacks.MMFeedbackSound.TestButton

◆ TestStopButton

bool MoreMountains.Feedbacks.MMFeedbackSound.TestStopButton

Property Documentation

◆ FeedbackDuration

override float MoreMountains.Feedbacks.MMFeedbackSound.FeedbackDuration
get

the duration of this feedback is the duration of the clip being played


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