Aimbot-ParallelEnv/Assets/Script/InGame/rayInfoUI.cs
Koha9 b53612d3c6 In-game real time reward chart, free camera, result viewer and etc...
In-game real time reward chart, 
result viewer, 
free camera,
kill bonus reward(not so good. set 0 to unuse it)

Fix ray-sensor throw error when initialization issue.
Fix ray-sensor info panel face to wrong position.
2022-11-03 07:10:00 +09:00

38 lines
1.0 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class rayInfoUI : MonoBehaviour
{
TextMeshProUGUI infoText;
bool infoTextReady = false;
// Start is called before the first frame update
void Start()
{
try
{
infoText = transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>();
infoTextReady = true;
}
catch (UnityException)
{
infoTextReady = false;
}
}
public void updateInfo(string info,Vector3 infoPosition, Color infoColor,Camera facetoCamera)
{
if (!infoTextReady)
{
infoText = transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>();
}
infoText.text = info;
infoText.color = infoColor;
transform.position = infoPosition;
Vector3 v = facetoCamera.transform.position - infoPosition;
v.x = v.z = 0.0f;
transform.LookAt(facetoCamera.transform.position - v);
transform.Rotate(0, 180, 0);
}
}