NG_/Assets/Scripts/UI/头部/HiddenView.cs

38 lines
891 B
C#
Raw Permalink Normal View History

2024-12-13 19:40:05 +08:00
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.EventSystems;
public class HiddenView : MonoBehaviour,IPointerClickHandler
{
public List<GameObject> hideObjects;
public GameObject hideObjectParent;
public List<GameObject> showObjects;
public void OnPointerClick(PointerEventData eventData)
{
if (CameraMove.isStaticMove)
{
return;
}
foreach (GameObject obj in hideObjects)
{
obj.SetActive(false);
}
if (hideObjectParent != null)
{
foreach (Transform child in hideObjectParent.transform)
{
child.gameObject.SetActive(false);
}
}
foreach (GameObject obj in showObjects)
{
obj.SetActive(true);
}
}
}