From 41312db32dccfa84a3d04d5a868dfad771ee5d8d Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Fri, 3 Feb 2023 22:35:19 -0500 Subject: [PATCH] add back impact audio --- NewHorizons/Components/AddPhysics.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NewHorizons/Components/AddPhysics.cs b/NewHorizons/Components/AddPhysics.cs index ec326c25..f9ebec84 100644 --- a/NewHorizons/Components/AddPhysics.cs +++ b/NewHorizons/Components/AddPhysics.cs @@ -45,6 +45,21 @@ public class AddPhysics : MonoBehaviour bodyGo.AddComponent(); bodyGo.AddComponent(); + var impactSensor = bodyGo.AddComponent(); + var audioSource = bodyGo.AddComponent(); + audioSource.maxDistance = 30; + audioSource.dopplerLevel = 0; + audioSource.rolloffMode = AudioRolloffMode.Custom; + audioSource.playOnAwake = false; + audioSource.spatialBlend = 1; + var owAudioSource = bodyGo.AddComponent(); + owAudioSource._audioSource = audioSource; + owAudioSource._track = OWAudioMixer.TrackName.Environment; + var objectImpactAudio = bodyGo.AddComponent(); + objectImpactAudio._minPitch = 0.4f; + objectImpactAudio._maxPitch = 0.6f; + objectImpactAudio._impactSensor = impactSensor; + bodyGo.SetActive(true); transform.parent = bodyGo.transform;