hellbound/Assets/Sources/Feel/MMFeedbacks/MMFeedbacksForThirdParty/MMTools/MMFeedbackMMSoundManagerSav...

57 lines
2.3 KiB
C#
Raw Normal View History

2021-11-26 11:16:25 +03:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading.Tasks;
using MoreMountains.Tools;
using UnityEngine.Audio;
namespace MoreMountains.Feedbacks
{
/// <summary>
/// This feedback will let you trigger save, load, and reset on MMSoundManager settings. You will need a MMSoundManager in your scene for this to work.
/// </summary>
[AddComponentMenu("")]
[FeedbackPath("Audio/MMSoundManager Save and Load")]
[FeedbackHelp("This feedback will let you trigger save, load, and reset on MMSoundManager settings. You will need a MMSoundManager in your scene for this to work.")]
public class MMFeedbackMMSoundManagerSaveLoad : MMFeedback
{
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.SoundsColor; } }
#endif
/// the possible modes you can use to interact with save settings
public enum Modes { Save, Load, Reset }
[Header("MMSoundManager Save and Load")]
/// the selected mode to interact with save settings on the MMSoundManager
[Tooltip("the selected mode to interact with save settings on the MMSoundManager")]
public Modes Mode = Modes.Save;
/// <summary>
/// On Play, saves, loads or resets settings
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (Active)
{
switch (Mode)
{
case Modes.Save:
MMSoundManagerEvent.Trigger(MMSoundManagerEventTypes.SaveSettings);
break;
case Modes.Load:
MMSoundManagerEvent.Trigger(MMSoundManagerEventTypes.LoadSettings);
break;
case Modes.Reset:
MMSoundManagerEvent.Trigger(MMSoundManagerEventTypes.ResetSettings);
break;
}
}
}
}
}