using UnityEngine;
/// <summary>
/// Handles what happens when the user clicks on a collider
/// </summary>
public class ClickBehavior : MonoBehaviour
{
    private void Update()
    {
        if (Input.GetMouseButton(0))
        {
            Vector2 clickPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(clickPoint, transform.up);
            if (hit.collider != null)
            {
                if (hit.collider.CompareTag("Resource"))
                {
                    hit.collider.GetComponent<ResourceMaker>().GenerateResource();
                }
            }
        }
    }
}
