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

public class Wololo : MonoBehaviour {
    
    Seguir objetivo;
    
    // Update is called once per frame
    private void Update()
    {
        if (!Input.GetMouseButtonDown(0))
        {
            return;
        }
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (!Physics.Raycast(ray, out hit))
        {
            return;
        }

        objetivo = hit.collider.GetComponentInChildren<Seguir>();

        if (objetivo != null)
        {
            objetivo.SendMessage("Convertir");
        }
    }
}
