using UnityEngine; using System.Collections; public class impactSFX_fence : MonoBehaviour { private AudioSource source; public AudioClip sfxImpFence; private float volLowRange = 0.5f; // Volume Low Range private float volHighRange = 1.0f; // Volume High Range private float pitchLowRange = 0.75f; // Pitch Low Range private float pitchHighRange = 1.0f; // Pitch High Range private float pitchDefault = 1.0f; // Pitch Default Value // FUNCTION: Find Audio Source component (attached to Player Avatar Object) void Awake(){ source = GetComponent (); } void PlayImpFence(){ source.pitch = Random.Range (pitchLowRange, pitchHighRange); source.PlayOneShot (sfxImpFence,0.3f); } void OnCollisionEnter(Collision col){ PlayImpFence (); } // // Use this for initialization // void Start () { // // } // // // Update is called once per frame // void Update () { // // } }