ShowTipTime.cs 802 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ShowTipTime : MonoBehaviour
  5. {
  6. public static ShowTipTime Instance;
  7. public float TimeFloat = 10;
  8. // Start is called before the first frame update
  9. void Awake()
  10. {
  11. Instance = this;
  12. }
  13. private void OnEnable()
  14. {
  15. t = 0;
  16. }
  17. private void OnDisable()
  18. {
  19. t = 0;
  20. TimeFloat = 10;
  21. }
  22. public float t;
  23. // Update is called once per frame
  24. void Update()
  25. {
  26. t = t + Time.deltaTime;
  27. if(t>TimeFloat)
  28. {
  29. this.gameObject.SetActive(false);
  30. }
  31. this.transform.position = OpenXRCamera.Instance.head.position;
  32. this.transform.eulerAngles = OpenXRCamera.Instance.head.eulerAngles;
  33. }
  34. }