MMFeedbacks  v1.6
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
MoreMountains.Feedbacks.MMFeedbacks Class Reference

A collection of MMFeedback, meant to be played altogether. This class provides a custom inspector to add and customize feedbacks, and public methods to trigger them, stop them, etc. You can either use it on its own, or bind it from another class and trigger it from there. More...

Inheritance diagram for MoreMountains.Feedbacks.MMFeedbacks:

Public Types

enum  InitializationModes { InitializationModes.Script, InitializationModes.Awake, InitializationModes.Start }
 
enum  SafeModes { SafeModes.Nope, SafeModes.EditorOnly, SafeModes.RuntimeOnly, SafeModes.Full }
 

Public Member Functions

virtual void Initialization ()
 Initializes the MMFeedbacks, setting this MMFeedbacks as the owner More...
 
virtual void Initialization (GameObject owner)
 A public method to initialize the feedback, specifying an owner that will be used as the reference for position and hierarchy by feedbacks More...
 
virtual void PlayFeedbacks ()
 Plays all feedbacks using the MMFeedbacks' position as reference, and no attenuation More...
 
virtual void PlayFeedbacks (Vector3 position, float attenuation=1.0f)
 Plays all feedbacks, specifying a position and attenuation. The position may be used by each Feedback and taken into account to spark a particle or play a sound for example. The attenuation is a factor that can be used by each Feedback to lower its intensity, usually you'll want to define that attenuation based on time or distance (using a lower attenuation value for feedbacks happening further away from the Player). More...
 
virtual void StopFeedbacks ()
 Stops all feedbacks from playing. More...
 
virtual void StopFeedbacks (Vector3 position, float attenuation=1.0f)
 Stops all feedbacks from playing, specifying a position and attenuation that can be used by the Feedbacks More...
 
virtual void ResetFeedbacks ()
 Calls each feedback's Reset method if they've defined one. An example of that can be resetting the initial color of a flickering renderer. More...
 
virtual void AutoRepair ()
 Unity sometimes has serialization issues. This method fixes that by fixing any bad sync that could happen. More...
 

Public Attributes

List< MMFeedbackFeedbacks = new List<MMFeedback>()
 a list of MMFeedback to trigger More...
 
InitializationModes InitializationMode = InitializationModes.Start
 the chosen initialization mode More...
 
SafeModes SafeMode = SafeModes.Full
 the selected safe mode More...
 
bool AutoPlayOnStart = false
 whether or not to play this feedbacks automatically on Start More...
 
bool DebugActive = false
 whether or not this MMFeedbacks is in debug mode More...
 

Static Public Attributes

static bool GlobalMMFeedbacksActive = true
 a global switch used to turn all feedbacks on or off globally More...
 

Protected Member Functions

virtual void Awake ()
 On Awake we initialize our feedbacks if we're in auto mode More...
 
virtual void Start ()
 On Start we initialize our feedbacks if we're in auto mode More...
 
virtual void PlayFeedbacksInternal (Vector3 position, float attenuation)
 An internal method used to play feedbacks, shouldn't be called externally More...
 
virtual IEnumerator PausedFeedbacksCo (Vector3 position, float attenuation)
 A coroutine used to pause feedbacks More...
 
virtual void OnDisable ()
 On Disable we stop all feedbacks More...
 
virtual void OnDestroy ()
 On Destroy, removes all feedbacks from this MMFeedbacks to avoid any leftovers More...
 

Protected Attributes

float _startTime = 0f
 
float _holdingMax = 0f
 
float _lastStartAt = 0f
 

Properties

bool IsPlaying [get, protected set]
 

Detailed Description

A collection of MMFeedback, meant to be played altogether. This class provides a custom inspector to add and customize feedbacks, and public methods to trigger them, stop them, etc. You can either use it on its own, or bind it from another class and trigger it from there.

Member Enumeration Documentation

◆ InitializationModes

the possible initialization modes. If you use Script, you'll have to initialize manually by calling the Initialization method and passing it an owner Otherwise, you can have this component initialize itself at Awake or Start, and in this case the owner will be the MMFeedbacks itself

Enumerator
Script 
Awake 
Start 

◆ SafeModes

the possible SafeModes (will perform checks to make sure no serialization error has damaged them)

  • nope : no safety
  • editor only : performs checks on enable
  • runtime only : performs checks on Awake
  • full : performs both editor and runtime checks, recommended setting
Enumerator
Nope 
EditorOnly 
RuntimeOnly 
Full 

Member Function Documentation

◆ AutoRepair()

virtual void MoreMountains.Feedbacks.MMFeedbacks.AutoRepair ( )
virtual

Unity sometimes has serialization issues. This method fixes that by fixing any bad sync that could happen.

◆ Awake()

virtual void MoreMountains.Feedbacks.MMFeedbacks.Awake ( )
protectedvirtual

On Awake we initialize our feedbacks if we're in auto mode

◆ Initialization() [1/2]

virtual void MoreMountains.Feedbacks.MMFeedbacks.Initialization ( )
virtual

Initializes the MMFeedbacks, setting this MMFeedbacks as the owner

◆ Initialization() [2/2]

virtual void MoreMountains.Feedbacks.MMFeedbacks.Initialization ( GameObject  owner)
virtual

A public method to initialize the feedback, specifying an owner that will be used as the reference for position and hierarchy by feedbacks

Parameters
owner
feedbacksOwner

◆ OnDestroy()

virtual void MoreMountains.Feedbacks.MMFeedbacks.OnDestroy ( )
protectedvirtual

On Destroy, removes all feedbacks from this MMFeedbacks to avoid any leftovers

◆ OnDisable()

virtual void MoreMountains.Feedbacks.MMFeedbacks.OnDisable ( )
protectedvirtual

On Disable we stop all feedbacks

◆ PausedFeedbacksCo()

virtual IEnumerator MoreMountains.Feedbacks.MMFeedbacks.PausedFeedbacksCo ( Vector3  position,
float  attenuation 
)
protectedvirtual

A coroutine used to pause feedbacks

Parameters
position
attenuation
Returns

◆ PlayFeedbacks() [1/2]

virtual void MoreMountains.Feedbacks.MMFeedbacks.PlayFeedbacks ( )
virtual

Plays all feedbacks using the MMFeedbacks' position as reference, and no attenuation

◆ PlayFeedbacks() [2/2]

virtual void MoreMountains.Feedbacks.MMFeedbacks.PlayFeedbacks ( Vector3  position,
float  attenuation = 1.0f 
)
virtual

Plays all feedbacks, specifying a position and attenuation. The position may be used by each Feedback and taken into account to spark a particle or play a sound for example. The attenuation is a factor that can be used by each Feedback to lower its intensity, usually you'll want to define that attenuation based on time or distance (using a lower attenuation value for feedbacks happening further away from the Player).

Parameters
position
feedbacksOwner
attenuation

◆ PlayFeedbacksInternal()

virtual void MoreMountains.Feedbacks.MMFeedbacks.PlayFeedbacksInternal ( Vector3  position,
float  attenuation 
)
protectedvirtual

An internal method used to play feedbacks, shouldn't be called externally

Parameters
position
attenuation

◆ ResetFeedbacks()

virtual void MoreMountains.Feedbacks.MMFeedbacks.ResetFeedbacks ( )
virtual

Calls each feedback's Reset method if they've defined one. An example of that can be resetting the initial color of a flickering renderer.

◆ Start()

virtual void MoreMountains.Feedbacks.MMFeedbacks.Start ( )
protectedvirtual

On Start we initialize our feedbacks if we're in auto mode

◆ StopFeedbacks() [1/2]

virtual void MoreMountains.Feedbacks.MMFeedbacks.StopFeedbacks ( )
virtual

Stops all feedbacks from playing.

◆ StopFeedbacks() [2/2]

virtual void MoreMountains.Feedbacks.MMFeedbacks.StopFeedbacks ( Vector3  position,
float  attenuation = 1.0f 
)
virtual

Stops all feedbacks from playing, specifying a position and attenuation that can be used by the Feedbacks

Parameters
position
attenuation

Member Data Documentation

◆ _holdingMax

float MoreMountains.Feedbacks.MMFeedbacks._holdingMax = 0f
protected

◆ _lastStartAt

float MoreMountains.Feedbacks.MMFeedbacks._lastStartAt = 0f
protected

◆ _startTime

float MoreMountains.Feedbacks.MMFeedbacks._startTime = 0f
protected

◆ AutoPlayOnStart

bool MoreMountains.Feedbacks.MMFeedbacks.AutoPlayOnStart = false

whether or not to play this feedbacks automatically on Start

◆ DebugActive

bool MoreMountains.Feedbacks.MMFeedbacks.DebugActive = false

whether or not this MMFeedbacks is in debug mode

◆ Feedbacks

List<MMFeedback> MoreMountains.Feedbacks.MMFeedbacks.Feedbacks = new List<MMFeedback>()

a list of MMFeedback to trigger

◆ GlobalMMFeedbacksActive

bool MoreMountains.Feedbacks.MMFeedbacks.GlobalMMFeedbacksActive = true
static

a global switch used to turn all feedbacks on or off globally

◆ InitializationMode

InitializationModes MoreMountains.Feedbacks.MMFeedbacks.InitializationMode = InitializationModes.Start

the chosen initialization mode

◆ SafeMode

SafeModes MoreMountains.Feedbacks.MMFeedbacks.SafeMode = SafeModes.Full

the selected safe mode

Property Documentation

◆ IsPlaying

bool MoreMountains.Feedbacks.MMFeedbacks.IsPlaying
getprotected set

whether or not this MMFeedbacks is playing right now - meaning it hasn't been stopped yet. if you don't stop your MMFeedbacks it'll remain true of course


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