|
|
- using UnityEngine;
- using System.Collections;
-
- public class impactSFX_pipe : MonoBehaviour {
-
- private AudioSource source;
- public AudioClip sfxImpPipe;
-
- 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
-
- private float lastHitTime = 0.0f;
- private float waitTime = 0.5f;
- // FUNCTION: Find Audio Source component (attached to Player Avatar Object)
- void Awake(){
- source = GetComponent<AudioSource> ();
- }
-
-
-
- void PlayImpPipe(){
- if (Time.time > lastHitTime + waitTime) {
- lastHitTime = Time.time;
- source.pitch = Random.Range (pitchLowRange, pitchHighRange);
- source.PlayOneShot (sfxImpPipe, 0.85f);
- }
- }
-
-
- void OnCollisionEnter(Collision col){
- PlayImpPipe ();
-
- }
-
-
- // // Use this for initialization
- // void Start () {
- //
- // }
- //
- // // Update is called once per frame
- // void Update () {
- //
- // }
-
-
-
- }
|