| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | |
| | | 5 | | public class Mirar : MonoBehaviour |
| | | 6 | | { |
| | | 7 | | public Canvas canvas; |
| | | 8 | | public Camera camaraAMirar; |
| | | 9 | | // Start is called before the first frame update |
| | | 10 | | void Start() |
| | 7 | 11 | | { |
| | 7 | 12 | | camaraAMirar = Camera.main; |
| | 7 | 13 | | } |
| | | 14 | | |
| | | 15 | | // Update is called once per frame |
| | | 16 | | void LateUpdate() |
| | 29617 | 17 | | { |
| | 29617 | 18 | | canvas.transform.rotation=Quaternion.LookRotation(camaraAMirar.transform.forward); |
| | 29617 | 19 | | } |
| | | 20 | | |
| | | 21 | | public void Mira() |
| | 4 | 22 | | { |
| | 4 | 23 | | canvas.GetComponent<Canvas>().enabled = true; |
| | 4 | 24 | | } |
| | | 25 | | |
| | | 26 | | public void Para() |
| | 4 | 27 | | { |
| | 4 | 28 | | canvas.GetComponent<Canvas>().enabled = false; |
| | 4 | 29 | | } |
| | | 30 | | } |