DropUnit.cs 736 B

12345678910111213141516171819202122232425
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class DropUnit : MonoBehaviour
  7. {
  8. public Text nameText;
  9. public Text digitText;
  10. public GameObject bingObj;
  11. public void Init(double lgtd,double lttd,string na,string di)
  12. {
  13. Vector3 temp = CoordinateConverter.GeoToUGUISmall(lgtd, lttd);
  14. this.GetComponent<RectTransform>().anchoredPosition3D = temp;
  15. nameText.text = na;
  16. digitText.text = di;
  17. }
  18. void Update()
  19. {
  20. this.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bingObj.transform.position) * 1920.0f / Screen.width;
  21. }
  22. }