42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using UnityEngine;
|
|
|
|
public class OutlineSelection : MonoBehaviour
|
|
{
|
|
private Transform _hightlight;
|
|
private Transform _selection;
|
|
private RaycastHit _raycastHit;
|
|
|
|
void Update()
|
|
{
|
|
//if (_hightlight != null)
|
|
//{
|
|
// _hightlight.gameObject.GetComponent<Outline>().enabled = false;
|
|
// _hightlight = null;
|
|
//}
|
|
|
|
//var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
//if (!EventSystem.current.IsPointerOverGameObject() && Physics.Raycast(ray, out _raycastHit))
|
|
//{
|
|
// _hightlight = _raycastHit.transform;
|
|
// if (_hightlight.CompareTag("Selectable") && _hightlight != _selection)
|
|
// {
|
|
// if (_hightlight.gameObject.GetComponent<Outline>() != null)
|
|
// {
|
|
// _hightlight.gameObject.GetComponent<Outline>().enabled = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// var outline = _hightlight.gameObject.AddComponent<Outline>();
|
|
// outline.enabled = true;
|
|
// _hightlight.gameObject.GetComponent<Outline>().OutlineColor = Color.yellow;
|
|
// _hightlight.gameObject.GetComponent<Outline>().OutlineWidth = 7f;
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// _hightlight = null;
|
|
// }
|
|
//}
|
|
}
|
|
}
|