using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class ClcikLight : MonoBehaviour { /// /// 被点击的红绿灯模型 /// public GameObject lightobj; /// /// 控制红绿灯1 /// public GameObject ControllightPanel1; /// /// 控制红绿灯2 /// public GameObject ControllightPanel2; void Start() { } public void OnMouseDown() { if (lightobj.name == "1号红绿灯") { ControllightPanel1.SetActive(true); ControllightPanel2.SetActive(false); } else { ControllightPanel1.SetActive(false); ControllightPanel2.SetActive(true); } } }