using UnityEngine;
using System.Collections;

public class Breakable : MonoBehaviour 
{
    public GameObject breakParticles;
    public int points;
    public string[] retorts;
    public AudioClip breakageSound;

    private PlayerController playerController;
    
    void Splatted()
    {
        playerController.message = retorts[Random.Range(0, retorts.Length)];
        OneShot3DAudio.PlayClipAtPoint(breakageSound, transform.position);

        Instantiate(breakParticles, transform.position, transform.rotation);
        playerController.AwardBreakagePoints(points);
        Destroy(gameObject);
    }

	void Awake() 
    {
	    playerController = FindObjectOfType<PlayerController>();
	}
	
}
