首次提交
This commit is contained in:
19
Assets/Scripts/Demo/WaterSplash.cs
Normal file
19
Assets/Scripts/Demo/WaterSplash.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class WaterSplash : MonoBehaviour
|
||||
{
|
||||
private AudioSource audioSource;
|
||||
|
||||
public AudioClip[] soundsClip;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
if (soundsClip.Length != 0)
|
||||
{
|
||||
int num = Random.Range(1, soundsClip.Length);
|
||||
audioSource.clip = soundsClip[num];
|
||||
audioSource.PlayOneShot(audioSource.clip, transform.localScale.magnitude * 0.3f);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user