Browse Source

小Tag 识别一次 路径高亮显示

DGJ 1 year ago
parent
commit
b5f08882ec

+ 5 - 5
Assets/Prefab/Route/Materials/LineMat_1.mat

@@ -13,7 +13,7 @@ Material:
   - _ALPHABLEND_ON
   - _EMISSION
   m_InvalidKeywords: []
-  m_LightmapFlags: 1
+  m_LightmapFlags: 2
   m_EnableInstancingVariants: 0
   m_DoubleSidedGI: 0
   m_CustomRenderQueue: 3000
@@ -41,11 +41,11 @@ Material:
         m_Offset: {x: 0, y: 0}
     - _EmissionMap:
         m_Texture: {fileID: 2800000, guid: d3f7a4a407ccaee48915bc7827f79dd6, type: 3}
-        m_Scale: {x: 1, y: 1}
+        m_Scale: {x: 1, y: 3}
         m_Offset: {x: 0, y: 0}
     - _MainTex:
         m_Texture: {fileID: 2800000, guid: d3f7a4a407ccaee48915bc7827f79dd6, type: 3}
-        m_Scale: {x: 1, y: 1}
+        m_Scale: {x: 1, y: 3}
         m_Offset: {x: 0, y: 0}
     - _MetallicGlossMap:
         m_Texture: {fileID: 0}
@@ -78,6 +78,6 @@ Material:
     - _UVSec: 0
     - _ZWrite: 0
     m_Colors:
-    - _Color: {r: 1, g: 1, b: 1, a: 1}
-    - _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
+    - _Color: {r: 0, g: 0.004813671, b: 1, a: 0.35686275}
+    - _EmissionColor: {r: 0, g: 0.54112554, b: 1, a: 1}
   m_BuildTextureStacks: []

+ 83 - 0
Assets/Prefab/Route/Materials/LineMat_1_High.mat

@@ -0,0 +1,83 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+  serializedVersion: 8
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_Name: LineMat_1_High
+  m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
+  m_ValidKeywords:
+  - _ALPHATEST_ON
+  - _EMISSION
+  m_InvalidKeywords: []
+  m_LightmapFlags: 2
+  m_EnableInstancingVariants: 0
+  m_DoubleSidedGI: 0
+  m_CustomRenderQueue: 2450
+  stringTagMap:
+    RenderType: TransparentCutout
+  disabledShaderPasses: []
+  m_SavedProperties:
+    serializedVersion: 3
+    m_TexEnvs:
+    - _BumpMap:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _DetailAlbedoMap:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _DetailMask:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _DetailNormalMap:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _EmissionMap:
+        m_Texture: {fileID: 2800000, guid: d3f7a4a407ccaee48915bc7827f79dd6, type: 3}
+        m_Scale: {x: 1, y: 3}
+        m_Offset: {x: 0, y: 0}
+    - _MainTex:
+        m_Texture: {fileID: 2800000, guid: d3f7a4a407ccaee48915bc7827f79dd6, type: 3}
+        m_Scale: {x: 1, y: 3}
+        m_Offset: {x: 0, y: -37.599712}
+    - _MetallicGlossMap:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _OcclusionMap:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _ParallaxMap:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    m_Ints: []
+    m_Floats:
+    - _BumpScale: 1
+    - _Cutoff: 0.5
+    - _DetailNormalMapScale: 1
+    - _DstBlend: 0
+    - _GlossMapScale: 1
+    - _Glossiness: 0.5
+    - _GlossyReflections: 1
+    - _Metallic: 0
+    - _Mode: 1
+    - _OcclusionStrength: 1
+    - _Parallax: 0.02
+    - _SmoothnessTextureChannel: 0
+    - _SpecularHighlights: 1
+    - _SrcBlend: 1
+    - _UVSec: 0
+    - _ZWrite: 1
+    m_Colors:
+    - _Color: {r: 0, g: 0.004813671, b: 1, a: 1}
+    - _EmissionColor: {r: 0, g: 0.54112554, b: 1, a: 1}
+  m_BuildTextureStacks: []

+ 8 - 0
Assets/Prefab/Route/Materials/LineMat_1_High.mat.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9c61c4cb267f6c14a978c54512e7ecae
+NativeFormatImporter:
+  externalObjects: {}
+  mainObjectFileID: 2100000
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 1
Assets/Resources/Route.prefab

@@ -29,7 +29,7 @@ Transform:
   m_GameObject: {fileID: 2671986348543453392}
   m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 0.05, y: 1, z: 0.05}
+  m_LocalScale: {x: 0.05, y: 1, z: 0.15}
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 8955719703749531883}
@@ -118,6 +118,7 @@ MonoBehaviour:
   Point: {fileID: 0}
   EndPos: {x: 0, y: 0, z: 0}
   StartPos: {x: 0, y: 0, z: 0}
+  material_High: {fileID: 2100000, guid: 9c61c4cb267f6c14a978c54512e7ecae, type: 2}
 --- !u!1 &8955719703749531882
 GameObject:
   m_ObjectHideFlags: 0

+ 1 - 1
Assets/Resources/RouteItem.prefab

@@ -29,7 +29,7 @@ Transform:
   m_GameObject: {fileID: 3745312271860900176}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 0.05, y: 1, z: 0.05}
+  m_LocalScale: {x: 0.05, y: 1, z: 0.15}
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 0}

+ 186 - 1
Assets/Scenes/LangChaoDemo2.unity

@@ -5182,6 +5182,71 @@ MeshFilter:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 415244614}
   m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1001 &421757522
+PrefabInstance:
+  m_ObjectHideFlags: 0
+  serializedVersion: 2
+  m_Modification:
+    m_TransformParent: {fileID: 0}
+    m_Modifications:
+    - target: {fileID: 3745312271860900176, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_Name
+      value: RouteItem
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900176, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_IsActive
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_RootOrder
+      value: 38
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalRotation.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalRotation.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalRotation.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900178, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: material_High
+      value: 
+      objectReference: {fileID: 2100000, guid: 9c61c4cb267f6c14a978c54512e7ecae, type: 2}
+    m_RemovedComponents: []
+  m_SourcePrefab: {fileID: 100100000, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
 --- !u!1 &422839096
 GameObject:
   m_ObjectHideFlags: 0
@@ -7461,6 +7526,54 @@ RectTransform:
   m_AnchoredPosition: {x: -0.33, y: 0.405}
   m_SizeDelta: {x: 906, y: 423}
   m_Pivot: {x: 0.5, y: 0.5}
+--- !u!1 &644259228
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 644259230}
+  - component: {fileID: 644259229}
+  m_Layer: 0
+  m_Name: Tracking Target
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!114 &644259229
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 644259228}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 062fe91f7f40e2842b56a188ab73f67d, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  trackID: 65
+  trackingIsLost: 0
+  m_debugView: 0
+  m_size: 0.17
+--- !u!4 &644259230
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 644259228}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 0}
+  m_RootOrder: 40
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &646504743
 GameObject:
   m_ObjectHideFlags: 0
@@ -8214,7 +8327,7 @@ MonoBehaviour:
   SingleCard: 1
   Gun: 1
   liBeaconType: -1
-  topoTagSize: 0
+  topoTagSize: 1
   guntype: -1
   singleSize: 1
 --- !u!4 &680435913
@@ -12001,7 +12114,9 @@ MonoBehaviour:
   cubeY: {fileID: 793407740}
   leftLine: {fileID: 0}
   rightLine: {fileID: 0}
+  isDataInit: 0
   listRoomName: []
+  listObjes: []
 --- !u!1 &1019880040
 GameObject:
   m_ObjectHideFlags: 0
@@ -12284,6 +12399,7 @@ MonoBehaviour:
   route: {fileID: 793121988}
   deviceName: {fileID: 1977591669859799792, guid: e555014e5146bba48913100bced00e98, type: 3}
   lookPoint: {fileID: 1429598954}
+  listRoot: []
 --- !u!1 &1045380967
 GameObject:
   m_ObjectHideFlags: 0
@@ -17380,6 +17496,75 @@ MonoBehaviour:
   m_OnValueChanged:
     m_PersistentCalls:
       m_Calls: []
+--- !u!1001 &1664066279
+PrefabInstance:
+  m_ObjectHideFlags: 0
+  serializedVersion: 2
+  m_Modification:
+    m_TransformParent: {fileID: 0}
+    m_Modifications:
+    - target: {fileID: 3745312271860900176, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_Name
+      value: RouteItem (1)
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900176, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_IsActive
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_RootOrder
+      value: 39
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: -0.83
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalRotation.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalRotation.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalRotation.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900177, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3745312271860900178, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: material_High
+      value: 
+      objectReference: {fileID: 2100000, guid: 9c61c4cb267f6c14a978c54512e7ecae, type: 2}
+    - target: {fileID: 3745312271860900180, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
+      propertyPath: m_Materials.Array.data[0]
+      value: 
+      objectReference: {fileID: 2100000, guid: 9c61c4cb267f6c14a978c54512e7ecae, type: 2}
+    m_RemovedComponents: []
+  m_SourcePrefab: {fileID: 100100000, guid: 5c04824020f93a64b99e33f31b4884a5, type: 3}
 --- !u!1 &1671353537
 GameObject:
   m_ObjectHideFlags: 0

+ 1 - 1
Assets/Scripts/Data/DataItem.cs

@@ -106,7 +106,7 @@ public class DataItem : MonoBehaviour
     {
         Transform point = foundTag.GetChild(0);
         point.position = transform.position;
-        offsetPos = point.localPosition;
+        offsetPos = new Vector3(point.localPosition.x, point.localPosition.y, offsetPos.z);
       
     }
 

+ 1 - 1
Assets/Scripts/Data/SettingMachineRoomData.cs

@@ -121,7 +121,7 @@ public class SettingMachineRoomData : MonoSingleton<SettingMachineRoomData>
         tagOPosYSlider.value = data.TagOffestPosY;
         tagOPosYText.text = data.TagOffestPosY.ToString();
 
-        cameraFarSlider.maxValue = 50;
+        cameraFarSlider.maxValue = 100;
         cameraFarSlider.minValue = 2;
         cameraFarSlider.value = data.CameraFar;
         cameraFarText.text = data.CameraFar.ToString();

+ 6 - 3
Assets/Scripts/Managers/BladeServerManager.cs

@@ -81,12 +81,14 @@ public class BladeServerManager : MonoSingleton<BladeServerManager>
     /// </summary>
     public TrackingLast OnTrackLast;
 
+    private bool isSync;
 
     private void Start()
     {
         tagObj = new GameObject("TagObj").transform;
         tagObj.position = Vector3.zero;
         tagObj.eulerAngles = Vector3.zero;
+        isSync = false;
 
         ManipulationHandler manipulation = selectPanel.GetComponent<ManipulationHandler>();
         manipulation.PointerDown.AddListener(( msg )=> { SelectPointerDown(); });
@@ -109,8 +111,8 @@ public class BladeServerManager : MonoSingleton<BladeServerManager>
 #endif
         //  Debug.Log(state);
 
-
-        TagSynchronization();
+        if (isSync)
+            TagSynchronization();
     }
 
     /// <summary>
@@ -121,7 +123,7 @@ public class BladeServerManager : MonoSingleton<BladeServerManager>
         if (foundItem != null && foundTag != null && !state)
         {
             dis = Vector3.Distance(foundTag.transform.position, OpenXRCamera.Instance.head.transform.position);
-
+            
             angle = Vector3.Angle(OpenXRCamera.Instance.head.GetComponent<Camera>().transform.forward, foundTag.transform.position - OpenXRCamera.Instance.head.transform.position);
 
             // Debug.Log("Dis " + dis + "  Angle" + angle + "  showDis  " + showDis + "  fadeDis " + fadeDis);
@@ -153,6 +155,7 @@ public class BladeServerManager : MonoSingleton<BladeServerManager>
 
                 foundItem.transform.eulerAngles = new Vector3(0, point.eulerAngles.y, 0);
                 foundItem.transform.position = point.transform.position;
+                isSync = false;
 
             }
             else if (Mathf.Abs(dis) > fadeDis)

+ 2 - 2
Assets/Scripts/Managers/MachineRoomManager.cs

@@ -120,7 +120,7 @@ public class MachineRoomManager : MonoSingleton<MachineRoomManager>
             data.list = 3;
             data.intervalW = 1;
             data.intervalL = 2;
-            data.cabinetW = 1.2f;
+            data.cabinetW = 0.6f;
             data.cabinetH = 2f;
             data.bladeSeverNumber = 4;
             data.bIntervalH = 0.2f;
@@ -438,7 +438,7 @@ public class MachineRoomManager : MonoSingleton<MachineRoomManager>
 
         SaveAllData();
         isInit = true;
-        StartCoroutine(RandomRange());
+      
     }
 
     public IEnumerator RandomRange()

+ 110 - 76
Assets/Scripts/Managers/WayFindingManager.cs

@@ -19,13 +19,15 @@ public class WayFindingManager : MonoSingleton<WayFindingManager>
     public GameObject route;
     public GameObject deviceName;
     public Transform lookPoint;
-    private List<GameObject> listRoot;
+    public List<Route> listRoot;
     private List<GameObject> listDeviceDoorName;
 
     private void Start()
     {
-        listRoot = new List<GameObject>();
+        listRoot = new List<Route>();
         listDeviceDoorName = new List<GameObject>();
+
+        StartCoroutine(SetHighRoute());
     }
 
     private void Update()
@@ -37,7 +39,7 @@ public class WayFindingManager : MonoSingleton<WayFindingManager>
             line.positionCount = 0;
             oldServerItem = serverItem;
             serverItem = null;
-            MachineRoomManager.Instance.RandomRange();
+         //   MachineRoomManager.Instance.RandomRange();
         }
     }
 
@@ -90,9 +92,10 @@ public class WayFindingManager : MonoSingleton<WayFindingManager>
 
     public void NavigatorServer(MachineObj serverItem)
     {
+        if(listRoot!=null)
         for (int i = 0; i < listRoot.Count; i++)
         {
-            listRoot[i].SetActive(false);
+            listRoot[i].gameObject.SetActive(false);
         }
         listRoot.Clear();
        
@@ -109,34 +112,34 @@ public class WayFindingManager : MonoSingleton<WayFindingManager>
         {
 
 
-            Vector3 pos1 = new Vector3(player.localPosition.x, 0, player.localPosition.z);
-            Vector3 pos2 = new Vector3(serverItem.transform.localPosition.x, 0, serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
+            Vector3 pos1 = new Vector3(player.localPosition.x, -1, player.localPosition.z);
+            Vector3 pos2 = new Vector3(serverItem.transform.localPosition.x, -1, serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
          
 
             List<Vector3> listPos = new List<Vector3>();
             listPos.Add(pos1);
             listPos.Add(pos2);
-            listPos.Add(new Vector3(serverItem.transform.localPosition.x,0,serverItem.transform.localPosition.z));
+            listPos.Add(new Vector3(serverItem.transform.localPosition.x, -1, serverItem.transform.localPosition.z));
             CreateRoute(listPos,serverItem,true);
 
         }
         else
         {
-            float leftDis = Vector3.Distance(new Vector3(player.localPosition.x, 0, player.localPosition.z), new Vector3(leftLine.localPosition.x, 0, leftLine.localPosition.z));
+            float leftDis = Vector3.Distance(new Vector3(player.localPosition.x, -1, player.localPosition.z), new Vector3(leftLine.localPosition.x, -1, leftLine.localPosition.z));
 
-            float rightDis = Vector3.Distance(new Vector3(player.localPosition.x, 0, player.localPosition.z), new Vector3(rightLine.localPosition.x, 0, rightLine.localPosition.z));
+            float rightDis = Vector3.Distance(new Vector3(player.localPosition.x, -1, player.localPosition.z), new Vector3(rightLine.localPosition.x, -1, rightLine.localPosition.z));
 
             if (Mathf.Abs(leftDis) < Mathf.Abs(rightDis))
             {
 
-                Vector3 pos1 = new Vector3(player.localPosition.x, 0, player.localPosition.z);
-                Vector3 pos2 = new Vector3(leftLine.localPosition.x, 0, player.localPosition.z);
+                Vector3 pos1 = new Vector3(player.localPosition.x, -1, player.localPosition.z);
+                Vector3 pos2 = new Vector3(leftLine.localPosition.x, -1, player.localPosition.z);
                 //Vector3 pos3 = new Vector3(leftLine.localPosition.x, 0, serverItem.navigatorPoint.localPosition.z + (serverItem.isSingle ? -1 : 1) * MachineRoomManager.Instance.data.cabinetW / 2.0f + MachineRoomManager.Instance.data.intervalL / 2.0f);
                 //Vector3 pos4 = new Vector3(serverItem.navigatorPoint.localPosition.x, 0, serverItem.navigatorPoint.localPosition.z + (serverItem.isSingle ? -1 : 1) * MachineRoomManager.Instance.data.cabinetW / 2.0f + MachineRoomManager.Instance.data.intervalL / 2.0f);
 
-                Vector3 pos3 = new Vector3(leftLine.localPosition.x,0,serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
+                Vector3 pos3 = new Vector3(leftLine.localPosition.x, -1, serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
 
-                Vector3 pos4 = new Vector3(serverItem.transform.localPosition.x, 0, serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
+                Vector3 pos4 = new Vector3(serverItem.transform.localPosition.x, -1, serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
 
 
                 List<Vector3> listpos = new List<Vector3>();
@@ -156,14 +159,14 @@ public class WayFindingManager : MonoSingleton<WayFindingManager>
                 //line.SetPosition(2, new Vector3(rightLine.localPosition.x, 0, serverItem.localPosition.z));
                 //line.SetPosition(3, new Vector3(serverItem.localPosition.x, 0, serverItem.localPosition.z));
 
-                Vector3 pos1 = new Vector3(player.localPosition.x, 0, player.localPosition.z);
-                Vector3 pos2 = new Vector3(rightLine.localPosition.x, 0, player.localPosition.z);
+                Vector3 pos1 = new Vector3(player.localPosition.x, -1, player.localPosition.z);
+                Vector3 pos2 = new Vector3(rightLine.localPosition.x, -1, player.localPosition.z);
                 //Vector3 pos3 = new Vector3(rightLine.localPosition.x, 0, serverItem.navigatorPoint.localPosition.z + (serverItem.isSingle ? -1 : 1) * MachineRoomManager.Instance.data.cabinetW / 2.0f + MachineRoomManager.Instance.data.intervalL / 2.0f);
                 //Vector3 pos4 = new Vector3(serverItem.navigatorPoint.localPosition.x, 0, serverItem.navigatorPoint.localPosition.z + (serverItem.isSingle ? -1 : 1) * MachineRoomManager.Instance.data.cabinetW / 2.0f + MachineRoomManager.Instance.data.intervalL / 2.0f);
 
-                Vector3 pos3 = new Vector3(rightLine.localPosition.x, 0, serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
+                Vector3 pos3 = new Vector3(rightLine.localPosition.x, -1, serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
 
-                Vector3 pos4 = new Vector3(serverItem.transform.localPosition.x, 0, serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
+                Vector3 pos4 = new Vector3(serverItem.transform.localPosition.x, -1, serverItem.transform.localPosition.z + ((serverItem.isSingle ? 1 : -1) * 1));
 
                 List<Vector3> listpos = new List<Vector3>();
                 listpos.Add(pos1);
@@ -176,85 +179,38 @@ public class WayFindingManager : MonoSingleton<WayFindingManager>
             }
         }
     }
-    private void CreateRoute(List<Vector3> listPos,MachineObj machineObj, bool isdevice)
-    {
-        for (int i = 0; i < listPos.Count - 1; i++)
-        {
-            GameObject route1 = GameObject.Instantiate(route, MachineRoomManager.Instance.transform);
-            route1.transform.localPosition = listPos[i];
-            lookPoint.localPosition = listPos[i + 1];
-            route1.transform.LookAt(lookPoint);
-            route1.SetActive(true);
-            listRoot.Add(route1);
-        }
-
-        if(isdevice&& machineObj)
-        {
-            GameObject devicedoorName = GameObject.Instantiate(deviceName, MachineRoomManager.Instance.transform);
-            devicedoorName.transform.localPosition = listPos[listPos.Count - 2];
-            devicedoorName.transform.LookAt(lookPoint);
-            devicedoorName.transform.localPosition = machineObj.transform.localPosition + new Vector3(0, 1, 0);
-            listDeviceDoorName.Add(devicedoorName);
-            devicedoorName.GetComponent<SettingDeviceName>().SettingName(machineObj.deviceParameters.deviceName);
-        }
-
-      
-
-    }
-    private void CreateRoute(List<Vector3> listPos , bool isDevice)
-    {
-        for (int i = 0; i < listPos.Count-1; i++)
-        {
-            GameObject route1 = GameObject.Instantiate(route, MachineRoomManager.Instance.transform);
-            route1.transform.localPosition = listPos[i];
-            lookPoint.localPosition = listPos[i + 1];
-            route1.transform.LookAt(lookPoint);
-            route1.SetActive(true);
-            listRoot.Add(route1);
-        }
-
-        if(isDevice)
-        {
-            GameObject devicedoorName = GameObject.Instantiate(deviceName, MachineRoomManager.Instance.transform);
-            devicedoorName.transform.localPosition = listPos[listPos.Count - 2];
-            lookPoint.localPosition += new Vector3(0, 0, 10);
-            devicedoorName.transform.LookAt(lookPoint);
-            listDeviceDoorName.Add(devicedoorName);
-        }
- 
-
-    }
+  
 
     public void NavigatorServer(List<MachineObj> listServerItem)
     {
         for (int i = 0; i < listRoot.Count; i++)
         {
-            listRoot[i].SetActive(false);
+            listRoot[i].transform.parent.gameObject.SetActive(false);
         }
         listRoot.Clear();
-        listRoot = new List<GameObject>();
+      
 
 
-        float leftDis = Vector3.Distance(new Vector3(player.localPosition.x, 0, player.localPosition.z), new Vector3(leftLine.localPosition.x, 0, leftLine.localPosition.z));
+        float leftDis = Vector3.Distance(new Vector3(player.localPosition.x, -1, player.localPosition.z), new Vector3(leftLine.localPosition.x, 0, leftLine.localPosition.z));
 
-        float rightDis = Vector3.Distance(new Vector3(player.localPosition.x, 0, player.localPosition.z), new Vector3(rightLine.localPosition.x, 0, rightLine.localPosition.z));
+        float rightDis = Vector3.Distance(new Vector3(player.localPosition.x, -1, player.localPosition.z), new Vector3(rightLine.localPosition.x, 0, rightLine.localPosition.z));
 
-        Vector3 pos1 = new Vector3(player.localPosition.x, 0, player.localPosition.z);
+        Vector3 pos1 = new Vector3(player.localPosition.x, -1, player.localPosition.z);
         Vector3 pos2;
         if(Mathf.Abs( leftDis)<Mathf.Abs( rightDis))
         {
-            pos2 = new Vector3(leftLine.localPosition.x, 0, player.localPosition.z);
+            pos2 = new Vector3(leftLine.localPosition.x, -1, player.localPosition.z);
         }
         else
         {
-            pos2 = new Vector3(rightLine.localPosition.x, 0, player.localPosition.z);
+            pos2 = new Vector3(rightLine.localPosition.x, -1, player.localPosition.z);
         }
 
         List<Vector3> listpos = new List<Vector3>();
 
         listpos.Add(pos1);
         listpos.Add(pos2);
-        listpos.Add(new Vector3(rightLine.localPosition.x, 0, player.localPosition.z + 10000));
+        listpos.Add(new Vector3(rightLine.localPosition.x, -1, player.localPosition.z + 10000));
         CreateRoute(listpos,null,false);    // 依据Player  生成两个固定点 当前Player点 和  出口点
 
 
@@ -263,11 +219,11 @@ public class WayFindingManager : MonoSingleton<WayFindingManager>
         {
             listpos.Clear();
 
-            listpos.Add(new Vector3(listServerItem[i].transform.localPosition.x, 0, listServerItem[i].transform.localPosition.z + ((listServerItem[i].isSingle ? 1 : -1) * 1)));
+            listpos.Add(new Vector3(listServerItem[i].transform.localPosition.x, -1, listServerItem[i].transform.localPosition.z + ((listServerItem[i].isSingle ? 1 : -1) * 1)));
             listpos.Add(listServerItem[i].transform.localPosition);
             CreateRoute(listpos,listServerItem[i],true); // 根据机位生成 机位点
 
-            Vector3 entrance = new Vector3(Mathf.Abs(leftDis) < Mathf.Abs(rightDis)?leftLine.localPosition.x:rightLine.localPosition.x,0, listServerItem[i].transform.localPosition.z + ((listServerItem[i].isSingle ? 1 : -1) * 1));
+            Vector3 entrance = new Vector3(Mathf.Abs(leftDis) < Mathf.Abs(rightDis)?leftLine.localPosition.x:rightLine.localPosition.x, -1, listServerItem[i].transform.localPosition.z + ((listServerItem[i].isSingle ? 1 : -1) * 1));
             bool finish = true;
 
 
@@ -290,11 +246,89 @@ public class WayFindingManager : MonoSingleton<WayFindingManager>
                 {
                     List<Vector3> listentrancePos = new List<Vector3>();
                     listentrancePos.Add(entrance);
-                    listentrancePos.Add(new Vector3(listServerItem[i].transform.localPosition.x, 0, listServerItem[i].transform.localPosition.z + ((listServerItem[i].isSingle ? 1 : -1) * 1)));
+                    listentrancePos.Add(new Vector3(listServerItem[i].transform.localPosition.x, -1, listServerItem[i].transform.localPosition.z + ((listServerItem[i].isSingle ? 1 : -1) * 1)));
                     CreateRoute(listentrancePos, listServerItem[i], false);  // 生成当前机位的 入口点
                 }
                    
             }
         }
     }
+
+    private void CreateRoute(List<Vector3> listPos, MachineObj machineObj, bool isdevice)
+    {
+        for (int i = 0; i < listPos.Count - 1; i++)
+        {
+            GameObject route1 = GameObject.Instantiate(route, MachineRoomManager.Instance.transform);
+            route1.transform.localPosition = listPos[i];
+            lookPoint.localPosition = listPos[i + 1];
+            route1.transform.LookAt(lookPoint);
+            route1.SetActive(true);
+            listRoot.Add(route1.transform.GetChild(0).GetComponent<Route>());
+        }
+
+        if (isdevice && machineObj)
+        {
+            GameObject devicedoorName = GameObject.Instantiate(deviceName, MachineRoomManager.Instance.transform);
+            devicedoorName.transform.localPosition = listPos[listPos.Count - 2];
+            devicedoorName.transform.LookAt(lookPoint);
+            devicedoorName.transform.localPosition = machineObj.transform.localPosition + new Vector3(0, 1, 0);
+            listDeviceDoorName.Add(devicedoorName);
+            devicedoorName.GetComponent<SettingDeviceName>().SettingName(machineObj.deviceParameters.deviceName);
+        }
+
+
+
+    }
+    private void CreateRoute(List<Vector3> listPos, bool isDevice)
+    {
+        for (int i = 0; i < listPos.Count - 1; i++)
+        {
+            GameObject route1 = GameObject.Instantiate(route, MachineRoomManager.Instance.transform);
+            route1.transform.localPosition = listPos[i];
+            lookPoint.localPosition = listPos[i + 1];
+            route1.transform.LookAt(lookPoint);
+            route1.SetActive(true);
+            listRoot.Add(route1.transform.GetChild(0).GetComponent<Route>());
+        }
+
+        if (isDevice)
+        {
+            GameObject devicedoorName = GameObject.Instantiate(deviceName, MachineRoomManager.Instance.transform);
+            devicedoorName.transform.localPosition = listPos[listPos.Count - 2];
+            lookPoint.localPosition += new Vector3(0, 0, 10);
+            devicedoorName.transform.LookAt(lookPoint);
+            listDeviceDoorName.Add(devicedoorName);
+        }
+
+
+    }
+
+    private IEnumerator SetHighRoute()
+    {
+        while(true)
+        {
+            yield return new WaitForSeconds(0.2f);
+
+            if(listRoot!=null&& listRoot.Count>1)
+            {
+                Route route = null;
+                route = listRoot[0];
+                for (int i = 1; i < listRoot.Count; i++)
+                {
+ 
+                    if (Mathf.Abs(Vector3.Distance(player.transform.position, listRoot[i].transform.position)) < Mathf.Abs(Vector3.Distance(player.transform.position, route.transform.position)))
+                    {
+                       
+                        route.setHighLight(false);
+                        route = listRoot[i];
+                    }
+                      
+
+                }
+
+                route.setHighLight(true);
+            }
+        }
+    } 
+
 }

+ 30 - 4
Assets/Scripts/Route.cs

@@ -4,7 +4,7 @@ using UnityEngine;
 
 public class Route : MonoBehaviour
 {
-    private Vector2 Interval = new Vector2(0, 0.01f);
+    private Vector2 Interval = new Vector2(0, 0.05f);
     public List<Material> ListLineMat;
     /// <summary>
     /// 旋转方向
@@ -13,19 +13,45 @@ public class Route : MonoBehaviour
     public Vector3 EndPos;
     public Vector3 StartPos;
 
+    public Material material_High;
     private Material material;
+    private MeshRenderer meshRenderer;
     private Vector2 offset;
 
     void Start()
     {
-        material = this.GetComponent<MeshRenderer>().material;
+        meshRenderer = this.GetComponent<MeshRenderer>();
+        material = meshRenderer.material;
         offset = Vector2.zero;
+
+        StartCoroutine(SetOffset());
     }
 
     void Update()
     {
-        offset -= Interval;
-        material.SetTextureOffset("_MainTex", offset);
+       
+    }
+
+    private IEnumerator SetOffset()
+    {
+        while(true)
+        {
+            yield return new WaitForSeconds(0.04f);
+            offset -= Interval;
+            material.SetTextureOffset("_MainTex", offset);
+            material_High.SetTextureOffset("_MainTex", offset);
+        }
+    }
+
+    public void setHighLight( bool isHigh)
+    {
+        // material.
+        if (isHigh)
+            meshRenderer.material = material_High;
+        else
+            meshRenderer.material = material;
+        
+
     }
 
     /// <summary>