From 6b7c10b022c020ae11c259a35e9184ea6dbb6f75 Mon Sep 17 00:00:00 2001 From: Jens Pitkanen Date: Mon, 20 Apr 2020 05:18:33 +0300 Subject: [PATCH] Fix campfire volume --- Assets/Audio Mixers/MainMixer.mixer | 134 +++++++++++++++++---- Assets/Prefabs/Environment/Campfire.prefab | 7 +- Assets/Scripts/CampfireSfx.cs | 2 +- 3 files changed, 117 insertions(+), 26 deletions(-) diff --git a/Assets/Audio Mixers/MainMixer.mixer b/Assets/Audio Mixers/MainMixer.mixer index 67746ea..7ca926f 100644 --- a/Assets/Audio Mixers/MainMixer.mixer +++ b/Assets/Audio Mixers/MainMixer.mixer @@ -1,5 +1,38 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!243 &-8678847571685279384 +AudioMixerGroupController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Ambient + m_AudioMixer: {fileID: 24100000} + m_GroupID: 3f76253721c9d6643aeee536840efa28 + m_Children: [] + m_Volume: d3d28f4b939c15c4fb46575e1562c52b + m_Pitch: 6ea43e4eb42e6dd4fa30fa24ac9530c9 + m_Send: 00000000000000000000000000000000 + m_Effects: + - {fileID: 5819159164487048221} + m_UserColorIndex: 0 + m_Mute: 0 + m_Solo: 0 + m_BypassEffects: 0 +--- !u!244 &-6842184747810701640 +AudioMixerEffectController: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_EffectID: fb8a516919e05534a986cfd7e35e5fad + m_EffectName: Attenuation + m_MixLevel: 9e1f6b3617d04854d8732138d9744bae + m_Parameters: [] + m_SendTarget: {fileID: 0} + m_EnableWetMix: 0 + m_Bypass: 0 --- !u!244 &-6119931374106344343 AudioMixerEffectController: m_ObjectHideFlags: 3 @@ -46,7 +79,9 @@ AudioMixerSnapshotController: m_AudioMixer: {fileID: 24100000} m_SnapshotID: ac9cc10b0c59e3b4682dc5089372ae81 m_FloatValues: + d3d28f4b939c15c4fb46575e1562c52b: 9.260412 3b873ffd7476b574ab79c605a05a50ff: 0 + fb93bc0e4abea1d4e840f1f2832ba33d: 2.850226 m_TransitionOverrides: {} --- !u!243 &-2967980135314984734 AudioMixerGroupController: @@ -67,6 +102,25 @@ AudioMixerGroupController: m_Mute: 0 m_Solo: 0 m_BypassEffects: 0 +--- !u!243 &-860412736225255873 +AudioMixerGroupController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Intense + m_AudioMixer: {fileID: 24100000} + m_GroupID: 9dc227c354f4f5349aa2a811c85b2415 + m_Children: [] + m_Volume: 311faa2cea2914047837331490b16dce + m_Pitch: 343a25624895ac04dbbd22aefe996640 + m_Send: 00000000000000000000000000000000 + m_Effects: + - {fileID: 5802288172188439303} + m_UserColorIndex: 0 + m_Mute: 0 + m_Solo: 0 + m_BypassEffects: 0 --- !u!245 &-815558828361742615 AudioMixerSnapshotController: m_ObjectHideFlags: 0 @@ -88,7 +142,10 @@ AudioMixerGroupController: m_Name: Fire m_AudioMixer: {fileID: 24100000} m_GroupID: 1bdb8c14a13a7064e887fd8c05bd43e7 - m_Children: [] + m_Children: + - {fileID: -8678847571685279384} + - {fileID: -860412736225255873} + - {fileID: 6572270565297822335} m_Volume: fd01f6bdeaa870c4688fa6fcad7c3e41 m_Pitch: fc8fd2fca838b3843a92c252855b9146 m_Send: 00000000000000000000000000000000 @@ -108,11 +165,10 @@ AudioMixerController: m_OutputGroup: {fileID: 0} m_MasterGroup: {fileID: 24300002} m_Snapshots: - - {fileID: 24500006} - {fileID: -3105936107480203619} - {fileID: 7009156351606643568} - {fileID: -815558828361742615} - m_StartSnapshot: {fileID: 24500006} + m_StartSnapshot: {fileID: -3105936107480203619} m_SuspendThreshold: -80 m_EnableSuspend: 1 m_UpdateMode: 1 @@ -132,9 +188,12 @@ AudioMixerController: - ecc30646201221445ab5a1cd672c78d8 - 440e1443b72e9e449a0e30e04101552d - 01ed36fd4259f874d8e152aa9f5cbdb4 + - 3f76253721c9d6643aeee536840efa28 + - 9dc227c354f4f5349aa2a811c85b2415 + - e98388ceee042154bb13e28dbe91c9a1 name: View m_CurrentViewIndex: 0 - m_TargetSnapshot: {fileID: 24500006} + m_TargetSnapshot: {fileID: 7009156351606643568} --- !u!243 &24300002 AudioMixerGroupController: m_ObjectHideFlags: 0 @@ -169,24 +228,6 @@ AudioMixerEffectController: 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: ff8dc610a6ec0d14cb32ecaf12b55eb7 - m_FloatValues: - 8f482920c408fd34e9c8792cf526bf12: 115 - b58fd3f8e205ca64aa5718e8bc864bc6: 0 - 350b5ae92de31b14eaf685d0e95ddd9b: 10 - 6ca751ba6a985aa4eb7f21b4ec43b475: -6898 - 2889b28bff25e764f9db668c9c682f67: -7135 - ad60b42d334c4ab41b80946c48f104a3: 4 - fd01f6bdeaa870c4688fa6fcad7c3e41: 0 - m_TransitionOverrides: {} --- !u!243 &586271417499195193 AudioMixerGroupController: m_ObjectHideFlags: 0 @@ -271,6 +312,53 @@ AudioMixerEffectController: m_SendTarget: {fileID: 0} m_EnableWetMix: 0 m_Bypass: 0 +--- !u!244 &5802288172188439303 +AudioMixerEffectController: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_EffectID: db4296debb3bb2c429f7aa5bd9d69be7 + m_EffectName: Attenuation + m_MixLevel: bcea5369bdc57954685c6540ea681828 + m_Parameters: [] + m_SendTarget: {fileID: 0} + m_EnableWetMix: 0 + m_Bypass: 0 +--- !u!244 &5819159164487048221 +AudioMixerEffectController: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_EffectID: 1004d49d9a80b334699a12cbb4f7d7d3 + m_EffectName: Attenuation + m_MixLevel: 1d52d650ce5fa974792a48c8e73c7e39 + m_Parameters: [] + m_SendTarget: {fileID: 0} + m_EnableWetMix: 0 + m_Bypass: 0 +--- !u!243 &6572270565297822335 +AudioMixerGroupController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Crackle + m_AudioMixer: {fileID: 24100000} + m_GroupID: e98388ceee042154bb13e28dbe91c9a1 + m_Children: [] + m_Volume: fb93bc0e4abea1d4e840f1f2832ba33d + m_Pitch: 6d3f06863229d024ca724bf74c369a9a + m_Send: 00000000000000000000000000000000 + m_Effects: + - {fileID: -6842184747810701640} + m_UserColorIndex: 0 + m_Mute: 0 + m_Solo: 0 + m_BypassEffects: 0 --- !u!245 &7009156351606643568 AudioMixerSnapshotController: m_ObjectHideFlags: 0 @@ -281,6 +369,8 @@ AudioMixerSnapshotController: m_AudioMixer: {fileID: 24100000} m_SnapshotID: 99acc46f1b1d7c24b861966f8835044d m_FloatValues: + d3d28f4b939c15c4fb46575e1562c52b: 8.614072 fd01f6bdeaa870c4688fa6fcad7c3e41: 0 3b873ffd7476b574ab79c605a05a50ff: 0 + fb93bc0e4abea1d4e840f1f2832ba33d: 2.850226 m_TransitionOverrides: {} diff --git a/Assets/Prefabs/Environment/Campfire.prefab b/Assets/Prefabs/Environment/Campfire.prefab index 398d08e..f19a1bb 100644 --- a/Assets/Prefabs/Environment/Campfire.prefab +++ b/Assets/Prefabs/Environment/Campfire.prefab @@ -69,6 +69,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d18e85062ab028c4ca9a84353fa8546d, type: 3} m_Name: m_EditorClassIdentifier: + GameState: {fileID: 0} ActiveBurnSource: {fileID: 964052589141395917} AmbientSource: {fileID: 6967554575247233918} IntenseAmbientSource: {fileID: 957089656851647374} @@ -166,7 +167,7 @@ AudioSource: m_GameObject: {fileID: 3090626986165219207} m_Enabled: 1 serializedVersion: 4 - OutputAudioMixerGroup: {fileID: -267709887311468707, guid: 032de345950918c4e89684078c6a7213, + OutputAudioMixerGroup: {fileID: -8678847571685279384, guid: 032de345950918c4e89684078c6a7213, type: 2} m_audioClip: {fileID: 0} m_PlayOnAwake: 0 @@ -5252,7 +5253,7 @@ AudioSource: m_GameObject: {fileID: 8502149746935864804} m_Enabled: 1 serializedVersion: 4 - OutputAudioMixerGroup: {fileID: -267709887311468707, guid: 032de345950918c4e89684078c6a7213, + OutputAudioMixerGroup: {fileID: 6572270565297822335, guid: 032de345950918c4e89684078c6a7213, type: 2} m_audioClip: {fileID: 0} m_PlayOnAwake: 0 @@ -5380,7 +5381,7 @@ AudioSource: m_GameObject: {fileID: 9045967002764336402} m_Enabled: 1 serializedVersion: 4 - OutputAudioMixerGroup: {fileID: -267709887311468707, guid: 032de345950918c4e89684078c6a7213, + OutputAudioMixerGroup: {fileID: -860412736225255873, guid: 032de345950918c4e89684078c6a7213, type: 2} m_audioClip: {fileID: 0} m_PlayOnAwake: 0 diff --git a/Assets/Scripts/CampfireSfx.cs b/Assets/Scripts/CampfireSfx.cs index 9dab324..788e6b7 100644 --- a/Assets/Scripts/CampfireSfx.cs +++ b/Assets/Scripts/CampfireSfx.cs @@ -25,7 +25,7 @@ public class CampfireSfx : MonoBehaviour { AmbientSource.volume = Mathf.Lerp(AmbientSource.volume, 0, 10f * Time.deltaTime); return; } else { - IntenseAmbientSource.volume = Mathf.Max(ActiveBurn, Mathf.Clamp((Campfire.Fuel - Campfire.GoodFuelAmount) / Campfire.GoodFuelAmount, 0, 1)); + IntenseAmbientSource.volume = Mathf.Max(ActiveBurn, Mathf.Clamp((Campfire.Fuel - Campfire.GoodFuelAmount) / Campfire.GoodFuelAmount, 0, 1) * 0.2f); ActiveBurnSource.volume = Mathf.Pow(ActiveBurn, 0.3f); AmbientSource.volume = Mathf.Lerp(AmbientSource.volume, 1, 10f * Time.deltaTime); }