using UnityEngine;

[RequireComponent(typeof(Collider))]
public class Hightlight : MonoBehaviour
{
    Color baseColor;
    void Start()
    {
        baseColor = GetComponent<Renderer>().material.color;
    }

    private void OnMouseOver()
    {
        if (Control.Reach(transform.position))
            GetComponent<Renderer>().material.color = Color.blue;
        else GetComponent<Renderer>().material.color = Color.yellow;
    }

    private void OnMouseExit()
    {
        GetComponent<Renderer>().material.color = baseColor;
    }
}
