فهرست منبع

限制一下模型摄像头开关

Void_F 9 ماه پیش
والد
کامیت
c4edfce43d
2فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 6 0
      Assets/ModelCameraCtrl.cs
  2. 2 0
      Assets/Scripts/UI/UIView/3D/GCZLLayer.cs

+ 6 - 0
Assets/ModelCameraCtrl.cs

@@ -33,8 +33,14 @@ public class ModelCameraCtrl : MonoBehaviour
         _Instance = this;
     }
 
+    public void SetCameraActive(bool flag)
+    {
+        _camera.enabled = flag;
+    }
+
     private void Start()
     {
+        SetCameraActive(false);
         // 初始化当前距离为初始偏移量的距离
         currentDistance = Vector3.Distance(_camera.transform.position, this.transform.position);
         // 确保初始距离在允许的范围内

+ 2 - 0
Assets/Scripts/UI/UIView/3D/GCZLLayer.cs

@@ -56,6 +56,7 @@ public class GCZLLayer : MonoBehaviour
         Info_DetailButton.onClick.AddListener(() =>
         {
             DetailTitleText.text = currentData.name;
+            ModelCameraCtrl._Instance.SetCameraActive(true);
             DetailPanel.SetActive(true);
         });
 
@@ -65,6 +66,7 @@ public class GCZLLayer : MonoBehaviour
         DetailExitButton.onClick.AddListener(() =>
         {
             DetailPanel.SetActive(false);
+            ModelCameraCtrl._Instance.SetCameraActive(false);
         });
 
         InfoPanel.SetActive(false);