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

public class CoconutAudio : MonoBehaviour {

	public AudioClip hitGround;
	public AudioClip hitPlayer;

	private AudioSource audio;

	void Start() {
		audio = gameObject.GetComponent<AudioSource>();
	}

	void OnCollisionEnter2D (Collision2D col) {
		if (col.gameObject.tag == "Player") {
			audio.PlayOneShot (hitPlayer, 0.7f);
		} 
		else {
			audio.PlayOneShot (hitGround, 0.7f);
		}
	}
}
