diff --git a/Assets/Audio/Having_a_Party_and_Playing_with_Fire.ogg b/Assets/Audio/Having_a_Party_and_Playing_with_Fire.ogg new file mode 100644 index 0000000..ad1dec4 Binary files /dev/null and b/Assets/Audio/Having_a_Party_and_Playing_with_Fire.ogg differ diff --git a/Assets/Audio/Having_a_Party_and_Playing_with_Fire.ogg.meta b/Assets/Audio/Having_a_Party_and_Playing_with_Fire.ogg.meta new file mode 100644 index 0000000..81c0df7 --- /dev/null +++ b/Assets/Audio/Having_a_Party_and_Playing_with_Fire.ogg.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: f38804d07e1b7804e8112dd2cfdee185 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio/Resources.meta b/Assets/Audio/Resources.meta new file mode 100644 index 0000000..55dc9c1 --- /dev/null +++ b/Assets/Audio/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b136faaf72d7dda4d85f9e47e4f5785f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio/Resources/BGMMixer.mixer b/Assets/Audio/Resources/BGMMixer.mixer new file mode 100644 index 0000000..c4ffbe0 --- /dev/null +++ b/Assets/Audio/Resources/BGMMixer.mixer @@ -0,0 +1,91 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!241 &24100000 +AudioMixerController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BGMMixer + 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: [] + m_AudioMixerGroupViews: + - guids: + - 566c5e0ddf85965418c4e928780bd1c2 + 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: 566c5e0ddf85965418c4e928780bd1c2 + m_Children: [] + m_Volume: e237ccf0dc4562d4d917288c333e4914 + m_Pitch: c51c08a02aeb2cb4ca6cba414805904c + m_Send: 00000000000000000000000000000000 + m_Effects: + - {fileID: 2747661610774394998} + - {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: d4017f5208cf4654998c6405c2123e09 + m_EffectName: Attenuation + m_MixLevel: 8927544744190b64eac9fd5220e88097 + 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: 4117f6b7fd784794ba09e4c024f88699 + m_FloatValues: {} + m_TransitionOverrides: {} +--- !u!244 &2747661610774394998 +AudioMixerEffectController: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_EffectID: e469285c525017b489ba03af652b3057 + m_EffectName: Pitch Shifter + m_MixLevel: 31e0ac09030b46f4bab48ed4fa32c94e + m_Parameters: + - m_ParameterName: Pitch + m_GUID: 488bd2ac94838f14cadbca3c4455b0de + - m_ParameterName: FFT size + m_GUID: cdf507051bdff514288a92de380a7b9d + - m_ParameterName: Overlap + m_GUID: b6daacd24e06c24488dd0c8d9b8bfd5f + - m_ParameterName: Max channels + m_GUID: 0cefbc19749a7554497b8722a7fbe766 + m_SendTarget: {fileID: 0} + m_EnableWetMix: 0 + m_Bypass: 0 diff --git a/Assets/Audio/Resources/BGMMixer.mixer.meta b/Assets/Audio/Resources/BGMMixer.mixer.meta new file mode 100644 index 0000000..b70e120 --- /dev/null +++ b/Assets/Audio/Resources/BGMMixer.mixer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d0e13768ad98ea0468763d11da851a31 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio/Resources/Bunk.wav b/Assets/Audio/Resources/Bunk.wav new file mode 100644 index 0000000..38c2114 Binary files /dev/null and b/Assets/Audio/Resources/Bunk.wav differ diff --git a/Assets/Audio/Resources/Bunk.wav.meta b/Assets/Audio/Resources/Bunk.wav.meta new file mode 100644 index 0000000..1193f54 --- /dev/null +++ b/Assets/Audio/Resources/Bunk.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: f43397d0b3eb08542bc9c35458308eba +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio/Resources/Credit.txt b/Assets/Audio/Resources/Credit.txt new file mode 100644 index 0000000..ada30ae --- /dev/null +++ b/Assets/Audio/Resources/Credit.txt @@ -0,0 +1 @@ +I made these with bxfr - Texel \ No newline at end of file diff --git a/Assets/Audio/Resources/Credit.txt.meta b/Assets/Audio/Resources/Credit.txt.meta new file mode 100644 index 0000000..71afdab --- /dev/null +++ b/Assets/Audio/Resources/Credit.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3ad24be65e3114542a1dcc3b8075919c +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio/Resources/Unk.wav b/Assets/Audio/Resources/Unk.wav new file mode 100644 index 0000000..5d8ae72 Binary files /dev/null and b/Assets/Audio/Resources/Unk.wav differ diff --git a/Assets/Audio/Resources/Unk.wav.meta b/Assets/Audio/Resources/Unk.wav.meta new file mode 100644 index 0000000..ae3a2d3 --- /dev/null +++ b/Assets/Audio/Resources/Unk.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 2cb067bd197684045a82612fcdab33a5 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Code/AudioHelper.cs b/Assets/Code/AudioHelper.cs new file mode 100644 index 0000000..8977c41 --- /dev/null +++ b/Assets/Code/AudioHelper.cs @@ -0,0 +1,63 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public static class AudioHelper { + static Dictionary ClipByID; + static Dictionary IDByClip; + + public enum AudioCategory : byte { + Music = 1, + Fx = 2, + Voice = 3 + } + + public static float VolumeLevel(AudioCategory category) { + return PlayerPrefs.GetFloat(category.ToString(), 0.375f); // Did you know default volume of 1 is a bad idea + } + + public static void SetVolume(AudioCategory category, float level) { + PlayerPrefs.SetFloat(category.ToString(), level); + PlayerPrefs.Save(); + } + + public static int ByClip(AudioClip clip) { + if (IDByClip == null) Init(); + if (IDByClip.TryGetValue(clip, out int idIfPresent)) { + return idIfPresent; + } + Debug.LogWarningFormat("{0} is not resources loaded clip!!", clip.name); + return 0; + } + + public static AudioClip ByID(int id) { + if (ClipByID == null) Init(); + try { + return ClipByID[id]; + } catch { + throw new System.Exception(string.Format("Failure to find SFX with ID {0}", id)); + } + + } + + // Build the audio lookup + static void Init() { + ClipByID = new Dictionary(); + IDByClip = new Dictionary(); + + var allAudio = Resources.LoadAll(""); + + for (int i = 0; i < allAudio.Length; ++i) { + var clip = allAudio[i]; + ClipByID.Add(i, clip); + IDByClip.Add(clip, i); + } + + var oString = "Loaded Sounds: "; + foreach (var key in ClipByID) { + oString += key; + } + + Debug.Log(oString); + } +} diff --git a/Assets/Code/AudioHelper.cs.meta b/Assets/Code/AudioHelper.cs.meta new file mode 100644 index 0000000..3ce53ec --- /dev/null +++ b/Assets/Code/AudioHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1affa7ecbd65bf04cb3ee7fd44d9f370 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Code/AudioProvider.cs b/Assets/Code/AudioProvider.cs new file mode 100644 index 0000000..cb9c3bb --- /dev/null +++ b/Assets/Code/AudioProvider.cs @@ -0,0 +1,43 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using EntityNetwork; + +public class AudioProvider : EntityBase, IAutoRegister +{ + public static AudioProvider Instance; + public override void Awake() { + base.Awake(); + Instance = this; + + bgmSrc = GetComponent(); + } + + public float musicSpeed = 1f; + AudioSource bgmSrc; + + public void Update() { + // TODO - This is WIP help + //bgmSrc.outputAudioMixerGroup. + } + + int lastAudioFrame = 0; + public static void PlaySFX(AudioClip sfx, AudioHelper.AudioCategory category = AudioHelper.AudioCategory.Fx, float volume = 1.0f, bool sendRemote = true) { + if (sfx == null) return; + if (sendRemote) + Instance.RaiseEvent('s', true, AudioHelper.ByClip(sfx), (byte)category, volume); + else + Instance.InternallyPlaySFXEvent(AudioHelper.ByClip(sfx), (byte)category, volume); + } + + [NetEvent('s')] + public void InternallyPlaySFXEvent(int sfxID, byte category, float volume) { + // Don't allow multiple audio sources to trigger at once + if (Time.frameCount == lastAudioFrame) return; + lastAudioFrame = Time.frameCount; + + var clip = AudioHelper.ByID(sfxID); + AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position, AudioHelper.VolumeLevel((AudioHelper.AudioCategory)category) * volume); + } +} diff --git a/Assets/Code/AudioProvider.cs.meta b/Assets/Code/AudioProvider.cs.meta new file mode 100644 index 0000000..5ed5e5e --- /dev/null +++ b/Assets/Code/AudioProvider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ff52355fe571224f9827356ec82bb42 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Board Render/BoardRender.unity b/Assets/Scenes/Board Render/BoardRender.unity index 316aa36..84ecb4a 100644 --- a/Assets/Scenes/Board Render/BoardRender.unity +++ b/Assets/Scenes/Board Render/BoardRender.unity @@ -838,6 +838,8 @@ GameObject: - component: {fileID: 1199366272} - component: {fileID: 1199366271} - component: {fileID: 1199366270} + - component: {fileID: 1199366274} + - component: {fileID: 1199366273} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera @@ -910,6 +912,118 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!82 &1199366273 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1199366269} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 24300002, guid: d0e13768ad98ea0468763d11da851a31, + type: 2} + m_audioClip: {fileID: 8300000, guid: f38804d07e1b7804e8112dd2cfdee185, type: 3} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 +--- !u!114 &1199366274 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1199366269} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8ff52355fe571224f9827356ec82bb42, type: 3} + m_Name: + m_EditorClassIdentifier: + EntityID: 900 + authorityID: -1 + musicSpeed: 1 --- !u!1 &1280147033 GameObject: m_ObjectHideFlags: 0