SWHeightUnit.cs 840 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class SWHeightUnit : MonoBehaviour
  6. {
  7. public Text nameText;
  8. public Text valueText;
  9. public GameObject bingObj;
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13. }
  14. public void Init(double lgtd, double lttd, string na, string we)
  15. {
  16. Vector3 temp = CoordinateConverter.GeoToUGUI(lgtd, lttd);
  17. this.GetComponent<RectTransform>().anchoredPosition3D = temp;
  18. nameText.text = na;
  19. valueText.text = we;
  20. }
  21. // Update is called once per frame
  22. void Update()
  23. {
  24. this.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bingObj.transform.position) * 1920.0f / Screen.width;
  25. }
  26. }