RuntimePoint.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using DG.Tweening;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.EventSystems;
  6. using UnityEngine.UI;
  7. public class RuntimePoint : MonoBehaviour
  8. {
  9. public Button btn;
  10. public Text text;
  11. public Image icon;
  12. public StaticImportant staticImp;
  13. public List<int> layerIDs = new List<int>();
  14. public RectTransform arrow;
  15. public GameObject bingObj;
  16. void Awake() {
  17. arrow.DOLocalMoveY(-40, 1.0f).SetLoops(-1, LoopType.Yoyo);
  18. }
  19. // Start is called before the first frame update
  20. void Start()
  21. {
  22. }
  23. public void InitPoint(Sprite newIcon, string name_pri, string newText) {
  24. text.text = newText;
  25. if(name_pri.Trim().Length > 0)
  26. staticImp = StaticLod.instance.staticImportantsDic[name_pri];
  27. icon.sprite = newIcon;
  28. }
  29. // Update is called once per frame
  30. void Update()
  31. {
  32. this.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bingObj.transform.position) * 1920.0f / Screen.width;
  33. this.GetComponent<RectTransform>().localScale = Vector3.one / CameraManager.instance.secondCamera.GetComponent<CameraBirdSec>().currentDistance * 20;
  34. }
  35. }