12345678910111213141516171819202122232425262728293031 |
- using System.Collections;
- using System.Collections.Generic;
- using Unity.Mathematics;
- using UnityEngine;
- using UnityEngine.UI;
- public class PathSign : MonoBehaviour
- {
- public GameObject bindObj;
- public Vector3 bindPos;
- // Update is called once per frame
- void LateUpdate()
- {
- if (bindObj != null)
- {
- this.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.secondCamera.WorldToScreenPoint(bindPos) / Screen.width * 1920.0f;
- float dyScale = 72 / CameraManager.instance.secondCamera.GetComponent<CameraBirdSec>().currentDistance;
- dyScale = math.clamp(dyScale, 1, 6);
- this.transform.localScale = new Vector3(dyScale, dyScale, dyScale);
- if (!bindObj.activeSelf || !bindObj.transform.parent.gameObject.activeSelf || !bindObj.transform.parent.parent.gameObject.activeSelf)
- {
- this.GetComponent<Image>().enabled = false;
- }
- else {
- this.GetComponent<Image>().enabled = true;
- }
- }
- }
- }
|