mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-11-11 04:22:40 +00:00
Audio Settings
This commit is contained in:
1 parent
4a942a73fb
commit
4ee32def84
7 files changed
+3657
-49
No files matched your search
@@ -0,0 +1,26 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Audio;
|
||||||
|
|
||||||
|
public class AudioManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
public AudioMixer theMixer;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
if (PlayerPrefs.HasKey("MasterVol"))
|
||||||
|
{
|
||||||
|
theMixer.SetFloat("MasterVol", PlayerPrefs.GetFloat("MasterVol"));
|
||||||
|
}
|
||||||
|
if (PlayerPrefs.HasKey("MusicVol"))
|
||||||
|
{
|
||||||
|
theMixer.SetFloat("MusicVol", PlayerPrefs.GetFloat("MusicVol"));
|
||||||
|
}
|
||||||
|
if (PlayerPrefs.HasKey("SFXVol"))
|
||||||
|
{
|
||||||
|
theMixer.SetFloat("SFXVol", PlayerPrefs.GetFloat("SFXVol"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+11
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ff8c6d62e5fc0f6478840a18add47f3a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!243 &-7289459987239430450
|
||||||
|
AudioMixerGroupController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: SFX
|
||||||
|
m_AudioMixer: {fileID: 24100000}
|
||||||
|
m_GroupID: d161be8aa53901b47b5b21111de006f5
|
||||||
|
m_Children: []
|
||||||
|
m_Volume: da0ff497ee2d45c4e8eb35ef605e5af0
|
||||||
|
m_Pitch: 860ad559d22c6104d96bd91b3c7e2b98
|
||||||
|
m_Send: 00000000000000000000000000000000
|
||||||
|
m_Effects:
|
||||||
|
- {fileID: 4911950373511324649}
|
||||||
|
m_UserColorIndex: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_Solo: 0
|
||||||
|
m_BypassEffects: 0
|
||||||
|
--- !u!243 &-4387083310922404584
|
||||||
|
AudioMixerGroupController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Music
|
||||||
|
m_AudioMixer: {fileID: 24100000}
|
||||||
|
m_GroupID: b52182c193517d44fbee4ebb5752cdd3
|
||||||
|
m_Children: []
|
||||||
|
m_Volume: 0d53fe17738958f459398ba3b89e2075
|
||||||
|
m_Pitch: 7de626099c3197146a33ee31cc624fe1
|
||||||
|
m_Send: 00000000000000000000000000000000
|
||||||
|
m_Effects:
|
||||||
|
- {fileID: -901686731692607832}
|
||||||
|
m_UserColorIndex: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_Solo: 0
|
||||||
|
m_BypassEffects: 0
|
||||||
|
--- !u!244 &-901686731692607832
|
||||||
|
AudioMixerEffectController:
|
||||||
|
m_ObjectHideFlags: 3
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_EffectID: a6a8b78c939aab340a4fe364d04a8adf
|
||||||
|
m_EffectName: Attenuation
|
||||||
|
m_MixLevel: a188e28f9a3bad248817184de4f8c706
|
||||||
|
m_Parameters: []
|
||||||
|
m_SendTarget: {fileID: 0}
|
||||||
|
m_EnableWetMix: 0
|
||||||
|
m_Bypass: 0
|
||||||
|
--- !u!241 &24100000
|
||||||
|
AudioMixerController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Main Mixer
|
||||||
|
m_OutputGroup: {fileID: 0}
|
||||||
|
m_MasterGroup: {fileID: 24300002}
|
||||||
|
m_Snapshots:
|
||||||
|
- {fileID: 24500006}
|
||||||
|
m_StartSnapshot: {fileID: 24500006}
|
||||||
|
m_SuspendThreshold: -80
|
||||||
|
m_EnableSuspend: 1
|
||||||
|
m_UpdateMode: 0
|
||||||
|
m_ExposedParameters:
|
||||||
|
- guid: 49ab6a0d2da5edc4e906645734208d18
|
||||||
|
name: MasterVol
|
||||||
|
- guid: 0d53fe17738958f459398ba3b89e2075
|
||||||
|
name: MusicVol
|
||||||
|
- guid: da0ff497ee2d45c4e8eb35ef605e5af0
|
||||||
|
name: SFXVol
|
||||||
|
m_AudioMixerGroupViews:
|
||||||
|
- guids:
|
||||||
|
- 6ff40938251f24d4794964c9287ddaa9
|
||||||
|
- b52182c193517d44fbee4ebb5752cdd3
|
||||||
|
- d161be8aa53901b47b5b21111de006f5
|
||||||
|
name: View
|
||||||
|
m_CurrentViewIndex: 0
|
||||||
|
m_TargetSnapshot: {fileID: 24500006}
|
||||||
|
--- !u!243 &24300002
|
||||||
|
AudioMixerGroupController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Master
|
||||||
|
m_AudioMixer: {fileID: 24100000}
|
||||||
|
m_GroupID: 6ff40938251f24d4794964c9287ddaa9
|
||||||
|
m_Children:
|
||||||
|
- {fileID: -4387083310922404584}
|
||||||
|
- {fileID: -7289459987239430450}
|
||||||
|
m_Volume: 49ab6a0d2da5edc4e906645734208d18
|
||||||
|
m_Pitch: 90c307b891f0b97499b7ea7a3473c370
|
||||||
|
m_Send: 00000000000000000000000000000000
|
||||||
|
m_Effects:
|
||||||
|
- {fileID: 24400004}
|
||||||
|
m_UserColorIndex: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_Solo: 0
|
||||||
|
m_BypassEffects: 0
|
||||||
|
--- !u!244 &24400004
|
||||||
|
AudioMixerEffectController:
|
||||||
|
m_ObjectHideFlags: 3
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_EffectID: f9f07f365903b224a95ce6022bd36bcf
|
||||||
|
m_EffectName: Attenuation
|
||||||
|
m_MixLevel: cbe802496c7bd174d8251e396eba177f
|
||||||
|
m_Parameters: []
|
||||||
|
m_SendTarget: {fileID: 0}
|
||||||
|
m_EnableWetMix: 0
|
||||||
|
m_Bypass: 0
|
||||||
|
--- !u!245 &24500006
|
||||||
|
AudioMixerSnapshotController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Snapshot
|
||||||
|
m_AudioMixer: {fileID: 24100000}
|
||||||
|
m_SnapshotID: 969a8d4c953f4d847bbf66360a7242a1
|
||||||
|
m_FloatValues: {}
|
||||||
|
m_TransitionOverrides: {}
|
||||||
|
--- !u!244 &4911950373511324649
|
||||||
|
AudioMixerEffectController:
|
||||||
|
m_ObjectHideFlags: 3
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_EffectID: 7934aa494e787544a900108ec81ba6a1
|
||||||
|
m_EffectName: Attenuation
|
||||||
|
m_MixLevel: 29ea72e6d762ef144bc81f09e3fbc414
|
||||||
|
m_Parameters: []
|
||||||
|
m_SendTarget: {fileID: 0}
|
||||||
|
m_EnableWetMix: 0
|
||||||
|
m_Bypass: 0
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c97f543260ac6cb409ed0760fe78c9a9
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 24100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+998
-45
File diff suppressed because it is too large.
Load diff
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using UnityEngine.Audio;
|
||||||
|
|
||||||
public class OptionsScreen : MonoBehaviour
|
public class OptionsScreen : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -11,6 +12,9 @@ public class OptionsScreen : MonoBehaviour
|
|||||||
public List<ResItem> resolutions = new List<ResItem>();
|
public List<ResItem> resolutions = new List<ResItem>();
|
||||||
private int selectedResolution;
|
private int selectedResolution;
|
||||||
public TMP_Text resolutionLabel;
|
public TMP_Text resolutionLabel;
|
||||||
|
public AudioMixer theMixer;
|
||||||
|
public TMP_Text masterLabel, musicLabel, SFXLabel;
|
||||||
|
public Slider masterSlider, musicSlider, SFXSlider;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
@@ -44,6 +48,18 @@ public class OptionsScreen : MonoBehaviour
|
|||||||
selectedResolution = resolutions.Count - 1;
|
selectedResolution = resolutions.Count - 1;
|
||||||
UpdateResLabel();
|
UpdateResLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float vol = 0f;
|
||||||
|
theMixer.GetFloat("MasterVol", out vol);
|
||||||
|
masterSlider.value = vol;
|
||||||
|
theMixer.GetFloat("MusicVol", out vol);
|
||||||
|
musicSlider.value = vol;
|
||||||
|
theMixer.GetFloat("SFXVol", out vol);
|
||||||
|
SFXSlider.value = vol;
|
||||||
|
|
||||||
|
masterLabel.text = Mathf.RoundToInt(masterSlider.value *5/3+100).ToString();
|
||||||
|
musicLabel.text = Mathf.RoundToInt(musicSlider.value *5/3+100).ToString();
|
||||||
|
SFXLabel.text = Mathf.RoundToInt(SFXSlider.value *5/3+100).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@@ -91,7 +107,26 @@ public class OptionsScreen : MonoBehaviour
|
|||||||
Screen.SetResolution(resolutions[selectedResolution].horizontal, resolutions[selectedResolution].vertical, fullscreenTog.isOn);
|
Screen.SetResolution(resolutions[selectedResolution].horizontal, resolutions[selectedResolution].vertical, fullscreenTog.isOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetMasterVol()
|
||||||
|
{
|
||||||
|
masterLabel.text = Mathf.RoundToInt(masterSlider.value *5/3+100).ToString();
|
||||||
|
theMixer.SetFloat("MasterVol", masterSlider.value);
|
||||||
|
PlayerPrefs.SetFloat("MasterVol", masterSlider.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMusicVol()
|
||||||
|
{
|
||||||
|
musicLabel.text = Mathf.RoundToInt(musicSlider.value *5/3+100).ToString();
|
||||||
|
theMixer.SetFloat("MusicVol", musicSlider.value);
|
||||||
|
PlayerPrefs.SetFloat("MusicVol", musicSlider.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSFXVol()
|
||||||
|
{
|
||||||
|
SFXLabel.text = Mathf.RoundToInt((SFXSlider.value *5/3+100)).ToString();
|
||||||
|
theMixer.SetFloat("SFXVol", SFXSlider.value);
|
||||||
|
PlayerPrefs.SetFloat("SFXVol", SFXSlider.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class ResItem
|
public class ResItem
|
||||||
|
|||||||
Generated
+2435
-4
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user