From e161bf8411774b017e401b79e48dd27e064c1217 Mon Sep 17 00:00:00 2001 From: jparent Date: Sun, 31 Jan 2016 10:50:01 -0500 Subject: [PATCH] add gameplay music and scrapping sounds --- Assets/prefabs/SoundManager.prefab | 130 ++++++++++++ Assets/prefabs/SoundManager.prefab.meta | 8 + Assets/scenes/GameplayScene.unity | 261 ++++++++++++++++++++---- Assets/scripts/SelectorWithBolts.cs | 11 +- 4 files changed, 361 insertions(+), 49 deletions(-) create mode 100644 Assets/prefabs/SoundManager.prefab create mode 100644 Assets/prefabs/SoundManager.prefab.meta diff --git a/Assets/prefabs/SoundManager.prefab b/Assets/prefabs/SoundManager.prefab new file mode 100644 index 0000000..42a1001 --- /dev/null +++ b/Assets/prefabs/SoundManager.prefab @@ -0,0 +1,130 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &112570 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 482894} + - 114: {fileID: 11481872} + - 82: {fileID: 8254278} + m_Layer: 0 + m_Name: SoundManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &482894 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 112570} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 68.77054, y: 63.639896, z: -21.318928} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!82 &8254278 +AudioSource: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 112570} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 1c296ba21b6931b44b1e99ed97e04bd8, type: 3} + m_PlayOnAwake: 0 + m_Volume: 0 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 +--- !u!114 &11481872 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 112570} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5c912191e47fdc349afa12621f50abfc, type: 3} + m_Name: + m_EditorClassIdentifier: + MainMenu: {fileID: 0} + Gameplay: {fileID: 0} + Scrapping: {fileID: 8254278} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 112570} + m_IsPrefabParent: 1 diff --git a/Assets/prefabs/SoundManager.prefab.meta b/Assets/prefabs/SoundManager.prefab.meta new file mode 100644 index 0000000..37b1a53 --- /dev/null +++ b/Assets/prefabs/SoundManager.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3dcfc1de5f482fc4ea4e680b504968f3 +timeCreated: 1454255360 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/scenes/GameplayScene.unity b/Assets/scenes/GameplayScene.unity index 403a9b6..c9acc13 100644 --- a/Assets/scenes/GameplayScene.unity +++ b/Assets/scenes/GameplayScene.unity @@ -8,25 +8,25 @@ SceneSettings: m_PVSPortalsArray: [] m_OcclusionBakeSettings: smallestOccluder: 5 - smallestHole: .25 + smallestHole: 0.25 backfaceThreshold: 100 --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 serializedVersion: 6 m_Fog: 0 - m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 - m_FogDensity: .00999999978 + m_FogDensity: 0.01 m_LinearFogStart: 0 m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: .211999997, g: .226999998, b: .259000003, a: 1} - m_AmbientEquatorColor: {r: .114, g: .125, b: .133000001, a: 1} - m_AmbientGroundColor: {r: .0469999984, g: .0430000015, b: .0350000001, a: 1} + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1 m_AmbientMode: 3 m_SkyboxMaterial: {fileID: 0} - m_HaloStrength: .5 + m_HaloStrength: 0.5 m_FlareStrength: 1 m_FlareFadeSpeed: 3 m_HaloTexture: {fileID: 0} @@ -40,7 +40,7 @@ RenderSettings: --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 5 + serializedVersion: 6 m_GIWorkflowMode: 1 m_LightmapsMode: 1 m_GISettings: @@ -65,7 +65,8 @@ LightmapSettings: m_TextureCompression: 1 m_FinalGather: 0 m_FinalGatherRayCount: 1024 - m_LightmapSnapshot: {fileID: 0} + m_ReflectionCompression: 2 + m_LightingDataAsset: {fileID: 0} m_RuntimeCPUUsage: 25 --- !u!196 &4 NavMeshSettings: @@ -73,20 +74,17 @@ NavMeshSettings: m_ObjectHideFlags: 0 m_BuildSettings: serializedVersion: 2 - agentRadius: .5 + agentRadius: 0.5 agentHeight: 2 agentSlope: 45 - agentClimb: .400000006 + agentClimb: 0.4 ledgeDropHeight: 0 maxJumpAcrossDistance: 0 accuratePlacement: 0 minRegionArea: 2 - cellSize: .166666672 + cellSize: 0.16666667 manualCellSize: 0 m_NavMeshData: {fileID: 0} ---- !u!127 &5 -LevelGameManager: - m_ObjectHideFlags: 0 --- !u!1 &16934334 GameObject: m_ObjectHideFlags: 0 @@ -109,8 +107,8 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 16934334} - m_LocalRotation: {x: .612653315, y: .0739248246, z: .0576999038, w: .784768701} - m_LocalPosition: {x: 9.18925858, y: 3.07682133, z: 4.39099312} + m_LocalRotation: {x: 0.6126533, y: 0.073924825, z: 0.057699904, w: 0.7847687} + m_LocalPosition: {x: 9.189259, y: 3.0768213, z: 4.390993} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1944057160} @@ -124,8 +122,8 @@ Light: m_Enabled: 1 serializedVersion: 6 m_Type: 1 - m_Color: {r: .437779039, g: .40900737, b: .654411793, a: 1} - m_Intensity: .159999996 + m_Color: {r: 0.43777904, g: 0.40900737, b: 0.6544118, a: 1} + m_Intensity: 0.16 m_Range: 10 m_SpotAngle: 30 m_CookieSize: 10 @@ -133,8 +131,9 @@ Light: m_Type: 0 m_Resolution: -1 m_Strength: 1 - m_Bias: .0500000007 - m_NormalBias: .400000006 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 m_Cookie: {fileID: 0} m_DrawHalo: 0 m_Flare: {fileID: 0} @@ -182,8 +181,8 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 201485588} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 11.5600004, y: 1.46200013, z: 9.34000015} - m_LocalScale: {x: .200000003, y: 6, z: 16} + m_LocalPosition: {x: 11.56, y: 1.4620001, z: 9.34} + m_LocalScale: {x: 0.2, y: 6, z: 16} m_Children: [] m_Father: {fileID: 1944057160} m_RootOrder: 6 @@ -279,9 +278,9 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 335385616} - m_LocalRotation: {x: 0, y: .707106829, z: 0, w: .707106709} - m_LocalPosition: {x: 4.65999985, y: 1.46200013, z: 13.29} - m_LocalScale: {x: .200000003, y: 6, z: 18} + m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071067} + m_LocalPosition: {x: 4.66, y: 1.4620001, z: 13.29} + m_LocalScale: {x: 0.2, y: 6, z: 18} m_Children: [] m_Father: {fileID: 1944057160} m_RootOrder: 5 @@ -376,7 +375,7 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 867116874} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: -.300000012, z: 0} + m_LocalPosition: {x: 0, y: -0.3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -442,14 +441,14 @@ Camera: m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 1 - m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844} m_NormalizedViewPortRect: serializedVersion: 2 x: 0 y: 0 width: 1 height: 1 - near clip plane: .300000012 + near clip plane: 0.3 far clip plane: 1000 field of view: 60 orthographic: 0 @@ -461,10 +460,11 @@ Camera: m_RenderingPath: -1 m_TargetTexture: {fileID: 0} m_TargetDisplay: 0 + m_TargetEye: 3 m_HDR: 0 m_OcclusionCulling: 1 m_StereoConvergence: 10 - m_StereoSeparation: .0219999999 + m_StereoSeparation: 0.022 m_StereoMirrorMode: 0 --- !u!4 &1008797119 Transform: @@ -472,8 +472,8 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1008797114} - m_LocalRotation: {x: .360729486, y: 7.61585568e-08, z: 7.61585568e-08, w: .932670474} - m_LocalPosition: {x: .449999988, y: 15.1800003, z: -3.75} + m_LocalRotation: {x: 0.3607295, y: 0.00000007615856, z: 0.00000007615856, w: 0.9326705} + m_LocalPosition: {x: 0.45, y: 15.18, z: -3.75} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -529,7 +529,7 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1018231122} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: .666631162, y: .145443216, z: 0} + m_LocalPosition: {x: 0.66663116, y: 0.14544322, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -555,8 +555,8 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1058309221} - m_LocalRotation: {x: 0, y: .4984878, z: 0, w: .866896749} - m_LocalPosition: {x: .498067886, y: 1.08000004, z: 11.7025299} + m_LocalRotation: {x: 0, y: 0.4984878, z: 0, w: 0.86689675} + m_LocalPosition: {x: 0.4980679, y: 1.08, z: 11.70253} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1296647346} @@ -592,14 +592,14 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0659941834f628445b182d075f37a958, type: 3} m_Name: m_EditorClassIdentifier: - xScale: 2.79999995 - yScale: 2.79999995 + xScale: 2.8 + yScale: 2.8 colSpacing: 0 rowSpacing: 0 dimension: 1 hexagon: {fileID: 118646, guid: 950731e814d3ade4c91c128681c35ce2, type: 2} PlayerColors: - - {r: .448275924, g: 1, b: 0, a: 1} + - {r: 0.44827592, g: 1, b: 0, a: 1} - {r: 1, g: 0, b: 0, a: 1} - {r: 0, g: 0, b: 0, a: 1} --- !u!4 &1173224168 @@ -608,7 +608,7 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1173224166} - m_LocalRotation: {x: .707106829, y: 0, z: 0, w: .707106709} + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071067} m_LocalPosition: {x: -23, y: -0, z: 10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] @@ -1116,9 +1116,9 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1374790521} - m_LocalRotation: {x: 0, y: .707106829, z: 0, w: .707106709} - m_LocalPosition: {x: 4.65999985, y: 1.46200013, z: 2.70000005} - m_LocalScale: {x: .200000003, y: 6, z: 18} + m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071067} + m_LocalPosition: {x: 4.66, y: 1.4620001, z: 2.7} + m_LocalScale: {x: 0.2, y: 6, z: 18} m_Children: [] m_Father: {fileID: 1944057160} m_RootOrder: 4 @@ -1629,11 +1629,128 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1727379601} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -1.94000006, y: 1.46200013, z: 9.34000015} - m_LocalScale: {x: .200000003, y: 6, z: 16} + m_LocalPosition: {x: -1.94, y: 1.4620001, z: 9.34} + m_LocalScale: {x: 0.2, y: 6, z: 16} m_Children: [] m_Father: {fileID: 1944057160} m_RootOrder: 7 +--- !u!1 &1774638454 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1774638457} + - 114: {fileID: 1774638456} + - 82: {fileID: 1774638455} + m_Layer: 0 + m_Name: SoundManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!82 &1774638455 +AudioSource: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1774638454} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 1c296ba21b6931b44b1e99ed97e04bd8, type: 3} + m_PlayOnAwake: 0 + m_Volume: 0 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 +--- !u!114 &1774638456 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1774638454} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5c912191e47fdc349afa12621f50abfc, type: 3} + m_Name: + m_EditorClassIdentifier: + MainMenu: {fileID: 0} + Gameplay: {fileID: 0} + Scrapping: {fileID: 1774638455} +--- !u!4 &1774638457 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1774638454} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 68.77054, y: 63.639896, z: -21.318928} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 9 --- !u!1001 &1777326589 Prefab: m_ObjectHideFlags: 0 @@ -2120,7 +2237,7 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1944057159} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -23.2999992, y: 8.48999977, z: -22.1000004} + m_LocalPosition: {x: -23.3, y: 8.49, z: -22.1} m_LocalScale: {x: 5, y: 5, z: 5} m_Children: - {fileID: 16934335} @@ -2420,9 +2537,63 @@ Prefab: propertyPath: m_ConnectedAnchor.z value: 2.86692966e-06 objectReference: {fileID: 0} + - target: {fileID: 11404228, guid: 435740a68d38e76438007304b084ccf7, type: 2} + propertyPath: scrappingSoundVolumeFactor + value: 0.05 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 435740a68d38e76438007304b084ccf7, type: 2} m_IsPrefabParent: 0 +--- !u!1001 &2073640671 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 405564, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 405564, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 405564, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 405564, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 405564, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 405564, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 405564, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 405564, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: m_RootOrder + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 8288362, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: panLevelCustomCurve.m_RotationOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8288362, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + propertyPath: reverbZoneMixCustomCurve.m_RotationOrder + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: bd6516b3d3e41624eabd5d444483f593, type: 2} + m_IsPrefabParent: 0 --- !u!1001 &2138339827 Prefab: m_ObjectHideFlags: 0 diff --git a/Assets/scripts/SelectorWithBolts.cs b/Assets/scripts/SelectorWithBolts.cs index e8d9b43..769649f 100644 --- a/Assets/scripts/SelectorWithBolts.cs +++ b/Assets/scripts/SelectorWithBolts.cs @@ -17,6 +17,9 @@ public class SelectorWithBolts : MonoBehaviour private SoundManager sm; + public float scrappingSoundThreshold = 1f; + public float scrappingSoundVolumeFactor = 0.05f; + void Awake() { rb = GetComponent(); @@ -47,20 +50,20 @@ public class SelectorWithBolts : MonoBehaviour RootCylinders[i].position = constraintPos; } - if( rb.velocity.sqrMagnitude > 0.7f) + if( rb.velocity.sqrMagnitude > scrappingSoundThreshold) { if (sm.Scrapping.isPlaying) { - sm.UpdateScrappingVolume( Mathf.Clamp(rb.velocity.sqrMagnitude * 0.05f , 0f, 1f)); + sm.UpdateScrappingVolume( Mathf.Clamp(rb.velocity.magnitude * scrappingSoundVolumeFactor, 0f, 1f)); } else { - sm.PlayScrappingSound(Mathf.Clamp(rb.velocity.sqrMagnitude * 0.05f, 0f, 1f)); + sm.PlayScrappingSound(Mathf.Clamp(rb.velocity.magnitude * scrappingSoundVolumeFactor, 0f, 1f)); } } else { - sm.StopScrappingSound(); + sm.UpdateScrappingVolume(0f); } }