39 lines
889 B
C#
39 lines
889 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UIrodPodSlotNumber : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Text slotNumbertext;
|
|
|
|
private RectTransform rectTransform;
|
|
|
|
public FRod currentRod;
|
|
|
|
public Vector3 worldPosition;
|
|
|
|
private void Start()
|
|
{
|
|
rectTransform = GetComponent<RectTransform>();
|
|
if ((bool)currentRod)
|
|
{
|
|
slotNumbertext.text = (1 + currentRod.indexOfslot).ToString();
|
|
}
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
Camera currentCameraView = FScriptsHandler.Instance.m_PlayerMain.currentCameraView;
|
|
if ((bool)currentCameraView)
|
|
{
|
|
float num = Vector3.Angle(worldPosition - currentCameraView.transform.position, currentCameraView.transform.forward);
|
|
if (num > -90f && num < 90f)
|
|
{
|
|
Vector2 vector = currentCameraView.WorldToViewportPoint(worldPosition);
|
|
rectTransform.anchorMin = vector;
|
|
rectTransform.anchorMax = vector;
|
|
}
|
|
}
|
|
}
|
|
}
|