38 lines
695 B
C#
38 lines
695 B
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.EventSystems;
|
||
|
|
|
||
|
|
public class MouseOverItem : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||
|
|
{
|
||
|
|
public List<GameObject> objs;
|
||
|
|
private void Awake()
|
||
|
|
{
|
||
|
|
SetItem(false);
|
||
|
|
}
|
||
|
|
public void OnPointerEnter(PointerEventData eventData)
|
||
|
|
{
|
||
|
|
|
||
|
|
SetItem(true);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnPointerExit(PointerEventData eventData)
|
||
|
|
{
|
||
|
|
|
||
|
|
SetItem(false);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public void SetItem(bool isActive)
|
||
|
|
{
|
||
|
|
if (objs != null)
|
||
|
|
{
|
||
|
|
foreach (var obj in objs)
|
||
|
|
{
|
||
|
|
obj.SetActive(isActive);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|