123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 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<GetPointPosSuccessEvent>(GetPointPosSuccess);
- }
- private void GetPointPosSuccess(GetPointPosSuccessEvent e)
- {
- angle = this.GetUtility<IGetAngleByTwoPointUtility>().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);
- //AR_Map.transform.localPosition = new Vector3(e.pointJsonInfos[0].x, 0, e.pointJsonInfos[0].y);
- pos1 = new Vector2(e.pointJsonInfos[0].x, e.pointJsonInfos[0].y);
- pos2 = new Vector2(e.pointJsonInfos[1].x, e.pointJsonInfos[1].y);
- this.UnSubscribeEvent<GetPointPosSuccessEvent>(GetPointPosSuccess);
- }
- public void SetPos(Vector3 pos1, Vector3 pos2)
- {
- angle = this.GetUtility<IGetAngleByTwoPointUtility>().GetAngleByTwoPoint(pos1.x,pos1.y,pos2.x,pos2.y);
- AR_Map.transform.localEulerAngles = new Vector3(0.0f, (float)angle, 0.0f);
- AR_Map.transform.localPosition = pos1;
- ScenePos1 = pos1;
- ScenePos2 = pos2;
- }
- }
|