BackKeyDialogUI.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using SC.InputSystem;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class BackKeyDialogUI : MonoBehaviour
  6. {
  7. Vector3 offset = new Vector3(0,0,1.2f);
  8. int cullingMask;
  9. void Awake() {
  10. if(SvrManager.Instance != null && SvrManager.Instance.head != null) {
  11. cullingMask = SvrManager.Instance.leftCamera.cullingMask;
  12. }
  13. }
  14. // Start is called before the first frame update
  15. void OnEnable()
  16. {
  17. if (SvrManager.Instance != null && SvrManager.Instance.head != null) {
  18. transform.position = SvrManager.Instance.head.TransformPoint(offset);
  19. transform.eulerAngles = SvrManager.Instance.head.eulerAngles;
  20. SvrManager.Instance.leftCamera.cullingMask = 0;
  21. SvrManager.Instance.rightCamera.cullingMask = 0;
  22. }
  23. }
  24. void OnDisable() {
  25. if(SvrManager.Instance != null && SvrManager.Instance.head != null) {
  26. SvrManager.Instance.leftCamera.cullingMask = cullingMask;
  27. SvrManager.Instance.rightCamera.cullingMask = cullingMask;
  28. }
  29. }
  30. public void PressEnter() {
  31. Application.Quit();
  32. }
  33. public void PressCancel() {
  34. gameObject.SetActive(false);
  35. }
  36. }