26 lines
No EOL
489 B
C#
26 lines
No EOL
489 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ImpactRandomPitch : MonoBehaviour
|
|
{
|
|
AudioSource source;
|
|
|
|
public float minPitch = 0.6f;
|
|
public float maxPitch = 1.5f;
|
|
|
|
void Start()
|
|
{
|
|
source = GetComponent<AudioSource>();
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider collider)
|
|
{
|
|
source.pitch = Random.Range(minPitch, maxPitch);
|
|
source.Play();
|
|
// Debug.Log("audio.Play Called");
|
|
}
|
|
|
|
|
|
|
|
} |