| | 1 | | using UnityEngine; |
| | 2 | | using TMPro; |
| | 3 | |
|
| | 4 | | public class UIHitMarker : MonoBehaviour { |
| | 5 | | // Start is called once before the first execution of Update after the MonoBehaviour is created |
| | 6 | | private TextMeshProUGUI _text; |
| | 7 | |
|
| 0 | 8 | | void Awake() { |
| 0 | 9 | | _text = GetComponentInChildren<TextMeshProUGUI>(); |
| 0 | 10 | | if (_text == null) { |
| 0 | 11 | | Debug.LogError("No TextMeshProUGUI component found in children."); |
| 0 | 12 | | } |
| 0 | 13 | | } |
| | 14 | |
|
| 0 | 15 | | public void SetHit() { |
| 0 | 16 | | _text.text = "x"; |
| 0 | 17 | | _text.color = Color.green; |
| 0 | 18 | | } |
| | 19 | |
|
| 0 | 20 | | public void SetMiss() { |
| 0 | 21 | | _text.text = "o"; |
| 0 | 22 | | _text.color = Color.red; |
| 0 | 23 | | } |
| | 24 | |
|
| | 25 | | // Update is called once per frame |
| 0 | 26 | | void LateUpdate() { |
| 0 | 27 | | transform.LookAt(Camera.main.transform); |
| 0 | 28 | | } |
| | 29 | | } |