50 lines
1.0 KiB
C#
50 lines
1.0 KiB
C#
using HighlightPlus;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
/// <summary>
|
|
/// ÎïÌå¸ßÁÁ
|
|
/// </summary>
|
|
public class OnMouseObj : MonoBehaviour
|
|
{
|
|
private HighlightEffect _highlight;
|
|
|
|
private void Awake()
|
|
{
|
|
_highlight = GetComponent<HighlightEffect>();
|
|
}
|
|
private void OnMouseDown()
|
|
{
|
|
if (EventSystem.current.IsPointerOverGameObject())
|
|
{
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
private void OnMouseEnter()
|
|
{
|
|
if (EventSystem.current.IsPointerOverGameObject())
|
|
{
|
|
return;
|
|
}
|
|
Debug.Log(gameObject.name);
|
|
_highlight.highlighted = true;
|
|
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
|
|
TipItem.Instance.ShwoTips(this.gameObject.name, pos);
|
|
}
|
|
|
|
private void OnMouseExit()
|
|
{
|
|
if (EventSystem.current.IsPointerOverGameObject())
|
|
{
|
|
return;
|
|
}
|
|
_highlight.highlighted = false;
|
|
TipItem.Instance.HideTips();
|
|
}
|
|
|
|
}
|