W_WuHuVR/Medicine/Assets/Scr/Touch_obj/CanTouch.cs

44 lines
973 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class CanTouch : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler
{
TouchScreen Touch;
public void OnPointerEnter(PointerEventData eventData)
{
Touch = UI_manage.inst.FBX_obj.transform.GetChild(0).GetComponent<TouchScreen>();
if (Touch != null)
{
//Debug.Log("可以旋转");
Touch.IsTouch = true;
}
}
public void OnPointerExit(PointerEventData eventData)
{
Touch = UI_manage.inst.FBX_obj.transform.GetChild(0).GetComponent<TouchScreen>();
if (Touch != null)
{
//Debug.Log("不可以旋转");
Touch.IsTouch = false;
}
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}