ViveControllerBehavior.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using Valve.VR;
  6. public class ViveControllerBehavior : AVRControllerBehavior
  7. {
  8. public override AVRControllerBehavior.BEH_TYPE BehaviourType
  9. {
  10. get
  11. {
  12. return AVRControllerBehavior.BEH_TYPE.LEGACY;
  13. }
  14. }
  15. public override bool HandCameraMode
  16. {
  17. get
  18. {
  19. return this.m_eMode == ViveControllerBehavior.OvrControllerMode.CAMERA;
  20. }
  21. set
  22. {
  23. if (value)
  24. {
  25. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.CAMERA);
  26. }
  27. }
  28. }
  29. public override bool IsHandCameraMode
  30. {
  31. get
  32. {
  33. return this.m_eMode == ViveControllerBehavior.OvrControllerMode.CAMERA;
  34. }
  35. }
  36. public override bool IsHandPenMode
  37. {
  38. get
  39. {
  40. return false;
  41. }
  42. }
  43. public override bool HandDanceMode
  44. {
  45. get
  46. {
  47. return this.m_bHandDanceMode && this.m_eMode == ViveControllerBehavior.OvrControllerMode.DANCE;
  48. }
  49. set
  50. {
  51. this.m_bHandDanceMode = value;
  52. if (value)
  53. {
  54. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.DANCE);
  55. }
  56. else if (!value && this.m_eMode == ViveControllerBehavior.OvrControllerMode.DANCE)
  57. {
  58. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.MOUSE_POINTER);
  59. }
  60. }
  61. }
  62. public override bool HandVRIKMode
  63. {
  64. get
  65. {
  66. return false;
  67. }
  68. set
  69. {
  70. }
  71. }
  72. public override bool HandYotogiMode
  73. {
  74. get
  75. {
  76. return false;
  77. }
  78. set
  79. {
  80. }
  81. }
  82. protected override void Awake()
  83. {
  84. base.Awake();
  85. GameMain.Instance.CMSystem.OvrPointerMode = Mathf.Max(Mathf.Min(0, GameMain.Instance.CMSystem.OvrPointerMode), 0);
  86. GameMain.Instance.CMSystem.OvrMoveMode = Mathf.Max(Mathf.Min(2, GameMain.Instance.CMSystem.OvrMoveMode), 0);
  87. OvrMgr.OvrObject ovr_obj = GameMain.Instance.OvrMgr.ovr_obj;
  88. this.m_trackedObject = base.GetComponent<SteamVR_TrackedObject>();
  89. this.m_txMode = base.transform.Find("UI/Canvas/Text").GetComponent<Text>();
  90. this.m_goModeCanvas = this.m_txMode.transform.parent.gameObject;
  91. this.m_goHandCamera = base.transform.Find("HandCamera").gameObject;
  92. this.m_HandCamera = this.m_goHandCamera.GetComponent<OvrHandCamera>();
  93. this.m_HandCamera.m_ctrl = this;
  94. this.m_trTrackedDeviceParent = base.transform.parent.Find("Tracked Devices");
  95. this.m_TrackObjs = this.m_trTrackedDeviceParent.GetComponentsInChildren<SteamVR_TrackedObject>(true);
  96. this.m_ArcTeleport = base.transform.Find("ArcTeleport").GetComponentInChildren<ArcTeleport>(true);
  97. this.m_ArcTeleport.SetCallBackOnMove(new ArcTeleport.dgOnMove(this.OnWarpMove));
  98. this.m_HandItem = base.transform.Find("HandItem").GetComponent<OvrHandItemMgr>();
  99. this.m_HandItem.m_ctrl = this;
  100. this.m_HandItem.gameObject.SetActive(false);
  101. this.m_goManHand = base.transform.Find("HandPlayer").gameObject;
  102. NDebug.Assert(this.m_goManHand != null, "HandPlayer 男の手が見つかりません。");
  103. this.m_goManHand.GetComponent<ViveHandAnimator>().Init(this.m_buttons);
  104. this.m_goManHand.SetActive(false);
  105. this.m_fCursorLaserEasing = GameMain.Instance.CMSystem.OvrViveCursorLaserEasing;
  106. if (this.m_bHandL)
  107. {
  108. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.MOVE);
  109. }
  110. else
  111. {
  112. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.MOUSE_POINTER);
  113. }
  114. }
  115. private void Start()
  116. {
  117. GameMain.Instance.OvrMgr.OvrCamera.m_bWheelToZoom = false;
  118. if (this.m_bHandL)
  119. {
  120. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.MOVE);
  121. }
  122. else
  123. {
  124. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.MOUSE_POINTER);
  125. }
  126. }
  127. private void OnEnable()
  128. {
  129. this.ChangeMode(this.m_eMode);
  130. }
  131. private void OnDisable()
  132. {
  133. this.m_HandItem.gameObject.SetActive(false);
  134. }
  135. private void ChangeMode(ViveControllerBehavior.OvrControllerMode f_eNewMode)
  136. {
  137. this.m_txMode.gameObject.SetActive(true);
  138. if (f_eNewMode == ViveControllerBehavior.OvrControllerMode.GRAB)
  139. {
  140. this.m_obj_controller.grip_collider.enabled = true;
  141. }
  142. else
  143. {
  144. this.m_obj_controller.grip_collider.enabled = false;
  145. }
  146. bool flag = false;
  147. if (f_eNewMode == ViveControllerBehavior.OvrControllerMode.CAMERA)
  148. {
  149. this.m_goHandCamera.SetActive(true);
  150. flag = true;
  151. }
  152. else
  153. {
  154. this.m_goHandCamera.SetActive(false);
  155. }
  156. if (f_eNewMode == ViveControllerBehavior.OvrControllerMode.ITEM)
  157. {
  158. this.m_HandItem.gameObject.SetActive(true);
  159. flag = true;
  160. }
  161. else
  162. {
  163. this.m_HandItem.gameObject.SetActive(false);
  164. }
  165. if (flag)
  166. {
  167. foreach (SteamVR_TrackedObject steamVR_TrackedObject in this.m_TrackObjs)
  168. {
  169. if (steamVR_TrackedObject.index == this.m_trackedObject.index)
  170. {
  171. steamVR_TrackedObject.gameObject.transform.localScale = new Vector3(0f, 0f, 0f);
  172. }
  173. }
  174. this.m_txMode.enabled = false;
  175. this.m_goManHand.SetActive(false);
  176. }
  177. else
  178. {
  179. if (this.m_eHandSubMode == ViveControllerBehavior.HandSubMode.CONTROLLER)
  180. {
  181. foreach (SteamVR_TrackedObject steamVR_TrackedObject2 in this.m_TrackObjs)
  182. {
  183. if (steamVR_TrackedObject2.index == this.m_trackedObject.index)
  184. {
  185. steamVR_TrackedObject2.gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
  186. }
  187. }
  188. this.m_goManHand.SetActive(false);
  189. }
  190. else if (this.m_eHandSubMode == ViveControllerBehavior.HandSubMode.MAN_HAND)
  191. {
  192. foreach (SteamVR_TrackedObject steamVR_TrackedObject3 in this.m_TrackObjs)
  193. {
  194. if (steamVR_TrackedObject3.index == this.m_trackedObject.index)
  195. {
  196. steamVR_TrackedObject3.gameObject.transform.localScale = new Vector3(0f, 0f, 0f);
  197. }
  198. }
  199. this.m_goManHand.SetActive(true);
  200. }
  201. this.m_txMode.enabled = true;
  202. }
  203. GameMain.Instance.OvrMgr.SystemUICamera.SetActiveVirtualCursorObjByNocurrent((!this.m_bHandL) ? UICamera.VCURSOR.RIGHT : UICamera.VCURSOR.LEFT, f_eNewMode == ViveControllerBehavior.OvrControllerMode.MOUSE_POINTER);
  204. this.m_txMode.text = this.m_strMode[(int)f_eNewMode];
  205. if (f_eNewMode == ViveControllerBehavior.OvrControllerMode.MOUSE_POINTER)
  206. {
  207. Text txMode = this.m_txMode;
  208. txMode.text += this.m_strPointerMode[GameMain.Instance.CMSystem.OvrPointerMode];
  209. }
  210. else if (f_eNewMode == ViveControllerBehavior.OvrControllerMode.MOVE)
  211. {
  212. Text txMode2 = this.m_txMode;
  213. txMode2.text += this.m_strMoveMode[GameMain.Instance.CMSystem.OvrMoveMode];
  214. }
  215. this.m_eMode = f_eNewMode;
  216. Debug.Log("コントローラモード変更:" + this.m_eMode.ToString());
  217. }
  218. private void ChangePointerMode(ViveControllerBehavior.PointerSubMode f_ePMode)
  219. {
  220. GameMain.Instance.CMSystem.OvrPointerMode = (int)f_ePMode;
  221. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.MOUSE_POINTER);
  222. }
  223. private void ChangeMoveMode(ViveControllerBehavior.MoveSubMode f_eSubMode)
  224. {
  225. GameMain.Instance.CMSystem.OvrMoveMode = (int)f_eSubMode;
  226. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.MOVE);
  227. }
  228. private void ChangeHandMode(ViveControllerBehavior.HandSubMode f_eSubMode)
  229. {
  230. this.m_eHandSubMode = f_eSubMode;
  231. this.ChangeMode(ViveControllerBehavior.OvrControllerMode.GRAB);
  232. }
  233. private void TouchPadToClick()
  234. {
  235. if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_L_CLICK))
  236. {
  237. this.m_bCursorMoveEnable = false;
  238. GameMain.Instance.OvrMgr.SystemUICamera.SetCurrentCursorSide((!this.m_bHandL) ? UICamera.VCURSOR.RIGHT : UICamera.VCURSOR.LEFT);
  239. NUty.EmurateMouseButton(2);
  240. if (this.m_coCursorMoveWait != null)
  241. {
  242. base.StopCoroutine(this.m_coCursorMoveWait);
  243. }
  244. this.m_coCursorMoveWait = base.StartCoroutine(this.CoCursorMoveWait());
  245. }
  246. else if (this.m_buttons.GetPressUp(AVRControllerButtons.BTN.VIRTUAL_L_CLICK))
  247. {
  248. NUty.EmurateMouseButton(4);
  249. }
  250. if (this.m_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_R_CLICK))
  251. {
  252. this.m_bCursorMoveEnable = false;
  253. GameMain.Instance.OvrMgr.SystemUICamera.SetCurrentCursorSide((!this.m_bHandL) ? UICamera.VCURSOR.RIGHT : UICamera.VCURSOR.LEFT);
  254. NUty.EmurateMouseButton(8);
  255. if (this.m_coCursorMoveWait != null)
  256. {
  257. base.StopCoroutine(this.m_coCursorMoveWait);
  258. }
  259. this.m_coCursorMoveWait = base.StartCoroutine(this.CoCursorMoveWait());
  260. }
  261. else if (this.m_buttons.GetPressUp(AVRControllerButtons.BTN.VIRTUAL_R_CLICK))
  262. {
  263. NUty.EmurateMouseButton(16);
  264. }
  265. }
  266. private IEnumerator CoCursorMoveWait()
  267. {
  268. yield return new WaitForSeconds(0.3f);
  269. this.m_bCursorMoveEnable = true;
  270. yield break;
  271. }
  272. private void TouchPadWheel()
  273. {
  274. if (this.m_device.GetTouchDown(4294967296UL))
  275. {
  276. this.m_fTrackPadBefY = this.m_device.GetAxis(EVRButtonId.k_EButton_Axis0).y;
  277. }
  278. else if (this.m_device.GetTouch(4294967296UL))
  279. {
  280. Vector2 axis = this.m_device.GetAxis(EVRButtonId.k_EButton_Axis0);
  281. float num = axis.y - this.m_fTrackPadBefY;
  282. if (0.1f < Mathf.Abs(num))
  283. {
  284. NUty.EmurateMouseWheel((int)(num * 10f));
  285. this.m_fTrackPadBefY = axis.y;
  286. }
  287. }
  288. }
  289. private void OnWarpMove(Vector3 f_vPosWorld, Vector3 f_vRotWorld)
  290. {
  291. GameMain.Instance.MainCamera.SetFootPos(f_vPosWorld, CameraMain.STAND_SIT.STAND);
  292. GameMain.Instance.MainCamera.SetRealHeadRot(f_vRotWorld, true);
  293. }
  294. protected virtual void Update()
  295. {
  296. this.m_device = SteamVR_Controller.Input((int)this.m_trackedObject.index);
  297. this.m_vMoveCam.x = (this.m_vMoveCam.y = (this.m_vMoveCam.z = (this.m_fRotCam = 0f)));
  298. this.m_vMoveVelocity.x = (this.m_vMoveVelocity.y = (this.m_vMoveVelocity.z = 0f));
  299. if (this.m_device.GetPressDown(2UL))
  300. {
  301. this.m_bPressMenuBtnLong = false;
  302. this.m_fMenuPressBeforeTime = Time.realtimeSinceStartup;
  303. }
  304. else if (this.m_device.GetPress(2UL))
  305. {
  306. if (!this.m_bPressMenuBtnLong && Time.realtimeSinceStartup - this.m_fMenuPressBeforeTime > 1.5f)
  307. {
  308. if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.MOUSE_POINTER)
  309. {
  310. int num = GameMain.Instance.CMSystem.OvrPointerMode + 1;
  311. if (1 <= num)
  312. {
  313. num = 0;
  314. }
  315. this.ChangePointerMode((ViveControllerBehavior.PointerSubMode)num);
  316. }
  317. else if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.MOVE)
  318. {
  319. int num2 = GameMain.Instance.CMSystem.OvrMoveMode + 1;
  320. if (3 <= num2)
  321. {
  322. num2 = 0;
  323. }
  324. this.ChangeMoveMode((ViveControllerBehavior.MoveSubMode)num2);
  325. }
  326. else if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.ITEM)
  327. {
  328. this.m_HandItem.NextModel();
  329. }
  330. else if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.GRAB)
  331. {
  332. ViveControllerBehavior.HandSubMode handSubMode = this.m_eHandSubMode + 1;
  333. if (handSubMode >= ViveControllerBehavior.HandSubMode.MAX)
  334. {
  335. handSubMode = ViveControllerBehavior.HandSubMode.CONTROLLER;
  336. }
  337. this.ChangeHandMode(handSubMode);
  338. }
  339. this.m_bPressMenuBtnLong = true;
  340. }
  341. }
  342. else if (this.m_device.GetPressUp(2UL) && !this.m_bPressMenuBtnLong)
  343. {
  344. if (this.m_device.GetPress(4UL))
  345. {
  346. GameMain.Instance.OvrMgr.OvrCamera.ReCallcOffset();
  347. GameMain.Instance.OvrMgr.OvrCamera.ShowUI(true);
  348. GameMain.Instance.OvrMgr.OvrCamera.UIPosReset(0f);
  349. }
  350. else
  351. {
  352. int num3 = (int)(this.m_eMode + 1);
  353. if (num3 == 5 && !this.m_bHandDanceMode)
  354. {
  355. num3++;
  356. }
  357. if (6 <= num3)
  358. {
  359. num3 = 0;
  360. }
  361. this.ChangeMode((ViveControllerBehavior.OvrControllerMode)num3);
  362. }
  363. }
  364. if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.MOUSE_POINTER)
  365. {
  366. if (GameMain.Instance.CMSystem.OvrPointerMode == 0)
  367. {
  368. RaycastHit raycastHit;
  369. if (this.m_bCursorMoveEnable && Physics.Raycast(base.transform.position, base.transform.rotation * Vector3.forward, out raycastHit, float.PositiveInfinity, 33554432))
  370. {
  371. Vector2 textureCoord = raycastHit.textureCoord;
  372. Vector2 a = new Vector2(1280f * ((textureCoord.x - this.m_fUiCursorMargin) / (1f - this.m_fUiCursorMargin * 2f)), 720f * ((textureCoord.y - this.m_fUiCursorMargin) / (1f - this.m_fUiCursorMargin * 2f)));
  373. Vector2 vector = GameMain.Instance.OvrMgr.SystemUICamera.GetOvrVirtualMousePos(this.m_bHandL);
  374. Vector2 a2 = a - vector;
  375. Vector2 b = a2 * this.m_fCursorLaserEasing;
  376. Vector2 v = vector + b;
  377. GameMain.Instance.OvrMgr.SystemUICamera.SetOvrVirtualMousePos(this.m_bHandL, v);
  378. }
  379. Debug.DrawLine(base.transform.position, base.transform.position + base.transform.rotation * (Vector3.forward * 10f), new Color(1f, 0f, 0f));
  380. this.TouchPadToClick();
  381. this.TouchPadWheel();
  382. if (this.m_device.GetPressUp(4UL))
  383. {
  384. GameMain.Instance.OvrMgr.OvrCamera.ToggleUI();
  385. }
  386. }
  387. }
  388. else if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.MOVE)
  389. {
  390. if (GameMain.Instance.CMSystem.OvrMoveMode == 0)
  391. {
  392. Vector2 vector2 = this.m_device.GetAxis(EVRButtonId.k_EButton_Axis0) * this.m_fMoveSpeed;
  393. if (this.m_device.GetPress(4294967296UL))
  394. {
  395. if (this.m_device.GetTouch(8589934592UL))
  396. {
  397. this.m_vMoveCam.y = vector2.y;
  398. }
  399. else if (this.m_device.GetPress(4UL))
  400. {
  401. this.m_fRotCam = vector2.x;
  402. }
  403. else
  404. {
  405. this.m_vMoveCam.x = -vector2.x;
  406. this.m_vMoveCam.z = vector2.y;
  407. }
  408. }
  409. }
  410. if (GameMain.Instance.CMSystem.OvrMoveMode == 2)
  411. {
  412. }
  413. }
  414. else if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.CAMERA)
  415. {
  416. if (this.m_device.GetTouchDown(8589934592UL))
  417. {
  418. this.m_HandCamera.Snap();
  419. }
  420. if (this.m_device.GetPressUp(4UL))
  421. {
  422. GameMain.Instance.OvrMgr.OvrCamera.ToggleUI();
  423. }
  424. }
  425. }
  426. public override Vector3 GetVelocityHand()
  427. {
  428. Vector3 result = default(Vector3);
  429. if (this.m_device == null)
  430. {
  431. return result;
  432. }
  433. if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.MOVE && GameMain.Instance.CMSystem.OvrMoveMode == 1)
  434. {
  435. if (this.m_device.GetTouchDown(8589934592UL))
  436. {
  437. this.m_vMoveTugPosBack = base.transform.position;
  438. }
  439. else if (this.m_device.GetTouch(8589934592UL))
  440. {
  441. if (this.m_goTestObj != null)
  442. {
  443. this.m_goTestObj.transform.position = base.transform.position;
  444. }
  445. Vector3 a = base.transform.position - this.m_vMoveTugPosBack;
  446. result = a * -1f;
  447. }
  448. }
  449. return result;
  450. }
  451. public override float GetRotHandY()
  452. {
  453. float num = 0f;
  454. if (this.m_device == null)
  455. {
  456. return num;
  457. }
  458. if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.MOVE && GameMain.Instance.CMSystem.OvrMoveMode == 1)
  459. {
  460. if (this.m_device.GetTouchDown(4UL))
  461. {
  462. Transform baseHeadTransform = GameMain.Instance.OvrMgr.OvrCamera.GetBaseHeadTransform();
  463. Vector3 position = baseHeadTransform.position;
  464. position.y = 0f;
  465. Vector3 vector = baseHeadTransform.rotation * Vector3.forward;
  466. vector.y = 0f;
  467. Vector3 position2 = base.transform.position;
  468. position2.y = 0f;
  469. Vector3 vector2 = position2 - position;
  470. this.m_fRotBack = Quaternion.FromToRotation(vector.normalized, vector2.normalized).eulerAngles.y;
  471. }
  472. else if (this.m_device.GetTouch(4UL))
  473. {
  474. Transform baseHeadTransform2 = GameMain.Instance.OvrMgr.OvrCamera.GetBaseHeadTransform();
  475. Vector3 position3 = baseHeadTransform2.position;
  476. position3.y = 0f;
  477. Vector3 vector3 = baseHeadTransform2.rotation * Vector3.forward;
  478. vector3.y = 0f;
  479. Vector3 position4 = base.transform.position;
  480. position4.y = 0f;
  481. Vector3 vector4 = position4 - position3;
  482. num = Quaternion.FromToRotation(vector3.normalized, vector4.normalized).eulerAngles.y - this.m_fRotBack;
  483. num *= -1f;
  484. }
  485. }
  486. return num;
  487. }
  488. protected virtual void LateUpdate()
  489. {
  490. if (this.m_device == null)
  491. {
  492. return;
  493. }
  494. if (this.m_eMode == ViveControllerBehavior.OvrControllerMode.MOVE && GameMain.Instance.CMSystem.OvrMoveMode == 1 && this.m_device.GetTouch(4UL))
  495. {
  496. Transform baseHeadTransform = GameMain.Instance.OvrMgr.OvrCamera.GetBaseHeadTransform();
  497. Vector3 position = baseHeadTransform.position;
  498. position.y = 0f;
  499. Vector3 vector = baseHeadTransform.rotation * Vector3.forward;
  500. vector.y = 0f;
  501. Vector3 position2 = base.transform.position;
  502. position2.y = 0f;
  503. Vector3 vector2 = position2 - position;
  504. this.m_fRotBack = Quaternion.FromToRotation(vector.normalized, vector2.normalized).eulerAngles.y;
  505. }
  506. }
  507. public float m_fPointerSpeed = 10f;
  508. public float m_fMoveSpeed = 10f;
  509. public Vector3 m_vMoveVelocity;
  510. public float m_fMenuPressBeforeTime;
  511. public float m_fCursorLaserEasing = 0.3f;
  512. public float m_fUiCursorMargin = 0.2f;
  513. public GameObject m_goTestObj;
  514. private readonly string[] m_strMode = new string[]
  515. {
  516. "GRAB",
  517. "POINTER",
  518. "MOVE",
  519. "CAMERA",
  520. "ITEM",
  521. "DANCE"
  522. };
  523. private readonly string[] m_strPointerMode = new string[]
  524. {
  525. "-LASER"
  526. };
  527. private readonly string[] m_strMoveMode = new string[]
  528. {
  529. "-DIR",
  530. "-DRAW",
  531. "-ARC"
  532. };
  533. [NonSerialized]
  534. private ViveControllerBehavior.OvrControllerMode m_eMode;
  535. protected SteamVR_TrackedObject m_trackedObject;
  536. protected Transform m_trTrackedDeviceParent;
  537. protected SteamVR_TrackedObject[] m_TrackObjs;
  538. protected SteamVR_Controller.Device m_device;
  539. protected bool m_bPressLeft;
  540. protected float m_fTrackPadBefY;
  541. protected Text m_txMode;
  542. protected GameObject m_goModeCanvas;
  543. protected Vector2 m_vPadStartPos;
  544. protected bool m_bPressMenuBtnLong;
  545. protected GameObject m_goHandCamera;
  546. protected OvrHandCamera m_HandCamera;
  547. protected Vector3 m_vMoveTugPosBack;
  548. protected Vector3 m_vMoveTugRotHnadPosBack;
  549. protected Vector3 m_vMoveTugRotHeadPosBack;
  550. protected Vector3 m_vMoveTugVector;
  551. protected ArcTeleport m_ArcTeleport;
  552. protected OvrHandItemMgr m_HandItem;
  553. protected bool m_bCursorMoveEnable = true;
  554. protected float m_fRotBack;
  555. protected Coroutine m_coCursorMoveWait;
  556. protected GameObject m_goManHand;
  557. [NonSerialized]
  558. private ViveControllerBehavior.HandSubMode m_eHandSubMode = ViveControllerBehavior.HandSubMode.MAN_HAND;
  559. private enum OvrControllerMode
  560. {
  561. GRAB,
  562. MOUSE_POINTER,
  563. MOVE,
  564. CAMERA,
  565. ITEM,
  566. DANCE,
  567. MAX
  568. }
  569. private enum PointerSubMode
  570. {
  571. LASER,
  572. MAX
  573. }
  574. private enum MoveSubMode
  575. {
  576. DIRECTIONAL,
  577. DRAW,
  578. ARC,
  579. MAX
  580. }
  581. private enum TouchSubMode
  582. {
  583. MAN,
  584. WOMAN
  585. }
  586. private enum HandSubMode
  587. {
  588. CONTROLLER,
  589. MAN_HAND,
  590. MAX
  591. }
  592. }