DebugVRStartup.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. public class DebugVRStartup : MonoBehaviour
  5. {
  6. public bool IsReady
  7. {
  8. get
  9. {
  10. return DebugVRStartup.m_bReady;
  11. }
  12. }
  13. private void Awake()
  14. {
  15. DebugVRStartup.m_bReady = false;
  16. DebugVRStartup.m_bReady = true;
  17. this.EnableObjects();
  18. }
  19. private void EnableObjects()
  20. {
  21. if (this.m_bForceCamPos)
  22. {
  23. GameMain.Instance.MainCamera.SetPos(new Vector3(0f, 1.7f, 0f));
  24. }
  25. if (this.m_bForceFadeIn)
  26. {
  27. GameMain.Instance.MainCamera.FadeIn(1f, false, null, true, true, default(Color));
  28. }
  29. if (this.m_goEnableObject != null)
  30. {
  31. this.m_goEnableObject.SetActive(true);
  32. }
  33. for (int i = 0; i < this.m_aryEnableObjects.Length; i++)
  34. {
  35. this.m_aryEnableObjects[i].SetActive(true);
  36. }
  37. }
  38. private IEnumerator CoWaitOvrLoad()
  39. {
  40. Debug.Log(Time.frameCount);
  41. float fTimeBef = Time.realtimeSinceStartup;
  42. while (GameMain.Instance.OvrMgr == null || !GameMain.Instance.IsVRDeviceReady)
  43. {
  44. yield return null;
  45. if (Time.realtimeSinceStartup - fTimeBef > 6f)
  46. {
  47. NDebug.Assert("DebugVRStartup Time Out!:VRデバイスを認識できませんでした。", false);
  48. }
  49. }
  50. DebugVRStartup.m_bReady = true;
  51. this.EnableObjects();
  52. yield break;
  53. }
  54. public GameObject m_goEnableObject;
  55. public GameObject[] m_aryEnableObjects;
  56. [Header("強制フェードイン(リリース時も有効)")]
  57. public bool m_bForceFadeIn;
  58. [Header("強制カメラ位置 0.0f, 1.7f, 0.0f (リリース時も有効)")]
  59. public bool m_bForceCamPos = true;
  60. public static bool m_bReady;
  61. }