| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 | 
							- using System.Collections;
 
- using System.Collections.Generic;
 
- using System.Net;
 
- using Unity.Mathematics;
 
- using Unity.VisualScripting;
 
- using UnityEngine;
 
- using UnityEngine.EventSystems;
 
- using XCharts.Runtime;
 
- public class LinePathUnit : MonoBehaviour
 
- {
 
-     public string startPos;
 
-     public string endPos;
 
-     public static float orderZ = 0.01f;
 
-     public GameObject lineRenderer;
 
-     void Start()
 
-     {
 
-         
 
-     }
 
-     public void SetPath(Vector3 start, Vector3 end)
 
-     {
 
-         this.transform.position = start;
 
-         
 
-         Vector3 direction = end - start;
 
-         Vector3 up = Vector3.up; // (0,1,0)
 
-         // 计算夹角
 
-         float angle = Vector3.Angle(direction, up);
 
-         // 使用叉积来判断方向
 
-         Vector3 crossProduct = Vector3.Cross(direction, up);
 
-         if (crossProduct.z < 0)
 
-         {
 
-             angle = 360 - angle;
 
-         }
 
-         //print(angle);
 
-         float distance = Vector3.Distance(end, start) * 1.02f;
 
-         this.transform.localScale = new Vector3(1, distance / 2, 1);
 
-         this.transform.eulerAngles = new Vector3(1, 1, -angle);
 
-         //this.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, orderZ++);
 
-     }
 
-     public void SetColor(Color color,Color color1) {
 
-         this.lineRenderer.GetComponent<MeshRenderer>().material.SetColor("_Color1",color);
 
-         this.lineRenderer.GetComponent<MeshRenderer>().material.SetColor("_Color2", color1);
 
-     }
 
-     private void Update()
 
-     {
 
-         if (CameraManager.instance.secondCamera != null)
 
-         {
 
-             float dyScale = CameraManager.instance.secondCamera.GetComponent<CameraBirdSec>().currentDistance / 14;
 
-             dyScale = math.clamp(dyScale, 0.5f, 5f);
 
-             this.transform.localScale = new Vector3(dyScale, this.transform.localScale.y, dyScale);
 
-             this.lineRenderer.GetComponent<MeshRenderer>().material.SetTextureScale("_MainTex", new Vector2(1, this.transform.localScale.y * 10 / this.transform.localScale.x));
 
-         }
 
-     }
 
- }
 
 
  |