OvrController.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using UnityEngine;
  3. public class OvrController : AVRController
  4. {
  5. public override bool IsHandCameraMode
  6. {
  7. get
  8. {
  9. return this.m_CtrlBehNow.IsHandCameraMode;
  10. }
  11. }
  12. public override bool HandCameraMode
  13. {
  14. get
  15. {
  16. return this.m_CtrlBehNow.HandCameraMode;
  17. }
  18. set
  19. {
  20. if (value)
  21. {
  22. this.m_CtrlBehNow.HandCameraMode = true;
  23. }
  24. }
  25. }
  26. public override bool IsHandPenMode
  27. {
  28. get
  29. {
  30. return this.m_CtrlBehNow.IsHandPenMode;
  31. }
  32. }
  33. public override AVRControllerBehavior.LIMIT_MODE HandLimitMode
  34. {
  35. get
  36. {
  37. return this.m_CtrlBehNow.HandLimitMode;
  38. }
  39. set
  40. {
  41. this.m_CtrlBehNow.HandLimitMode = value;
  42. }
  43. }
  44. public override bool HandDanceMode
  45. {
  46. get
  47. {
  48. return this.m_CtrlBehNow.HandDanceMode;
  49. }
  50. set
  51. {
  52. this.m_CtrlBehNow.HandDanceMode = value;
  53. }
  54. }
  55. public override bool HandModelVisible
  56. {
  57. get
  58. {
  59. return this.m_CtrlBehNow.HandModelVisible;
  60. }
  61. set
  62. {
  63. this.m_CtrlBehNow.HandModelVisible = value;
  64. }
  65. }
  66. public override bool HandVRIKMode
  67. {
  68. get
  69. {
  70. return this.m_CtrlBehNow.HandVRIKMode;
  71. }
  72. set
  73. {
  74. this.m_CtrlBehNow.HandVRIKMode = value;
  75. }
  76. }
  77. public override bool HandYotogiMode
  78. {
  79. get
  80. {
  81. return this.m_CtrlBehNow.HandYotogiMode;
  82. }
  83. set
  84. {
  85. this.m_CtrlBehNow.HandYotogiMode = value;
  86. }
  87. }
  88. public override void Init()
  89. {
  90. base.Init();
  91. this.m_CtrlBehOld = base.GetComponent<OvrControllerBehavior>();
  92. this.m_CtrlBehOld.Init(this);
  93. this.m_CtrlBehNew = base.GetComponent<OvrControllerBehavior2>();
  94. this.m_CtrlBehNew.Init(this);
  95. }
  96. private void EnableHandHitChara(bool f_bEnable)
  97. {
  98. if (base.HandEnable != f_bEnable)
  99. {
  100. if (f_bEnable)
  101. {
  102. int maidCount = GameMain.Instance.CharacterMgr.GetMaidCount();
  103. for (int i = 0; i < maidCount; i++)
  104. {
  105. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i);
  106. if (maid != null && maid.body0)
  107. {
  108. if (this.m_bHandL)
  109. {
  110. maid.body0.m_trHandHitL = this.m_trHandHit;
  111. }
  112. else
  113. {
  114. maid.body0.m_trHandHitR = this.m_trHandHit;
  115. }
  116. }
  117. }
  118. }
  119. else
  120. {
  121. int maidCount2 = GameMain.Instance.CharacterMgr.GetMaidCount();
  122. for (int j = 0; j < maidCount2; j++)
  123. {
  124. Maid maid2 = GameMain.Instance.CharacterMgr.GetMaid(j);
  125. if (maid2 != null && maid2.body0)
  126. {
  127. maid2.body0.m_trHandHitL = null;
  128. maid2.body0.m_trHandHitR = null;
  129. }
  130. }
  131. }
  132. }
  133. base.HandEnable = f_bEnable;
  134. }
  135. protected void Update()
  136. {
  137. if ((OVRInput.GetActiveController() & OVRInput.Controller.LTouch) == OVRInput.Controller.None && (OVRInput.GetActiveController() & OVRInput.Controller.RTouch) == OVRInput.Controller.None)
  138. {
  139. base.transform.localScale = new Vector3(0f, 0f, 0f);
  140. this.EnableHandHitChara(false);
  141. return;
  142. }
  143. base.transform.localScale = new Vector3(1f, 1f, 1f);
  144. this.EnableHandHitChara(true);
  145. }
  146. }