26 lines
544 B
C#
26 lines
544 B
C#
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, base.transform.localScale.magnitude * 0.3f);
|
|
Object.Destroy(base.gameObject, 2f);
|
|
}
|
|
}
|
|
|
|
private void OnParticleSystemStopped()
|
|
{
|
|
Object.Destroy(base.gameObject);
|
|
}
|
|
}
|