using Blue; using System; using UnityEngine; public class PointCouldAutoMatchController : AbstractController { public GameObject AR_Map; public Vector2 pos1; public Vector2 pos2; public double angle; public Vector3 ScenePos1; public Vector3 ScenePos2; private void Awake() { this.SubscribeEvent(GetPointPosSuccess); } private void GetPointPosSuccess(GetPointPosSuccessEvent e) { // 因为屏幕坐标跟普通坐标不同,所依y为-y angle = this.GetUtility().GetAngleByTwoPoint(e.pointJsonInfos[0].x, -e.pointJsonInfos[0].y, e.pointJsonInfos[1].x, -e.pointJsonInfos[1].y); AR_Map.transform.localEulerAngles = new Vector3(0.0f, (float)angle, 0.0f); //获取角度 pos1 = new Vector2(e.pointJsonInfos[0].x, e.pointJsonInfos[0].y); pos2 = new Vector2(e.pointJsonInfos[1].x, e.pointJsonInfos[1].y); this.UnSubscribeEvent(GetPointPosSuccess); } public void SetPos(Vector3 pos1, Vector3 pos2) { AR_Map.transform.localPosition = pos1; ScenePos1 = pos1; ScenePos2 = pos2; } }