using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class Crack : MonoBehaviour
{
    private CrackManager manager;

    [Header("Crack Sprites")]
    public Sprite[] crackSprites;  
    private Image image;
    
    private void Awake()
    {
        image = GetComponent<Image>();
        if (crackSprites != null && crackSprites.Length > 0 && image != null)
        {
            image.sprite = crackSprites[Random.Range(0, crackSprites.Length)];
        }
    }
    
    public void Init(CrackManager m)
    {
        manager = m;
    }

    public void Destroy()
    {
        manager.CrackDestroyed();
        Destroy(gameObject);
    }    
}
