Эх сурвалжийг харах

控制扫图后关闭识别功能

蓝色星空 2 жил өмнө
parent
commit
122e388c15

+ 35 - 0
Assets/Script/ControlLocalizer.cs

@@ -0,0 +1,35 @@
+using Immersal.AR.Nreal;
+using UnityEngine;
+
+public class ControlLocalizer: MonoBehaviour
+{
+    public NRLocalizer NRLocalizer;
+    public GameObject obj;
+    public GameObject irobot;
+
+    private float tra_X;
+    private float tra_Y;
+    private float time = 0f;
+
+
+    private void Start()
+    {
+        tra_X = obj.transform.position.x;
+        tra_Y = obj.transform.position.y;
+    }
+    void Update()
+    {
+        time += Time.deltaTime;
+
+        if(time > 1  && irobot.activeSelf) 
+        {
+            NRLocalizer.Localize();
+            time= 0;
+        }
+
+        if (obj.transform.position.x != tra_X || obj.transform.position.y != tra_Y)
+        {
+            enabled= false;
+        }
+    }
+}

+ 11 - 0
Assets/Script/ControlLocalizer.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ee7e6d4fe3022624dbedb3cea308fd58
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: