using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(AudioSource))]

public class CollisionSound : MonoBehaviour
{

    public AudioSource audioSource;
    public AudioClip[] collisionSounds;
    
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    private void OnCollisionEnter(Collision collision)
    {
        this.audioSource.clip = this.collisionSounds[Random.Range(0, this.collisionSounds.Length)];
        this.audioSource.Play();
    }
}
