DanceFpsCam.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using UnityEngine;
  3. public class DanceFpsCam : PartsMgrBase
  4. {
  5. protected override void Start()
  6. {
  7. base.Start();
  8. base.IsActive &= (!GameMain.Instance.VRMode && DanceSetting.Settings.FPSCamMode);
  9. if (!base.IsActive)
  10. {
  11. base.enabled = false;
  12. return;
  13. }
  14. this.m_OrijinFov = GameMain.Instance.MainCamera.camera.fieldOfView;
  15. GameMain.Instance.VRDummyMode = true;
  16. GameMain.Instance.OvrInit();
  17. UICamera.isDisableRightClick = true;
  18. GameMain.Instance.OvrMgr.OvrCamera.ChangeControllerNew(true);
  19. GameMain.Instance.OvrMgr.OvrCamera.IsForceRightClickUiToggle = true;
  20. GameMain.Instance.MainCamera.SetTargetPos(this.m_InitCamPos, true);
  21. GameMain.Instance.MainCamera.SetAroundAngle(this.m_InitCamRot, true);
  22. GameMain.Instance.MainCamera.SetDistance(this.m_InitDistance, true);
  23. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Free, false);
  24. }
  25. private void OnDestroy()
  26. {
  27. if (base.IsActive)
  28. {
  29. UICamera.isDisableRightClick = false;
  30. GameMain.Instance.OvrMgr.OvrCamera.ChangeControllerNew(false);
  31. GameMain.Instance.OvrMgr.OvrCamera.IsForceRightClickUiToggle = false;
  32. GameMain.Instance.VRDummyMode = false;
  33. GameMain.Instance.OvrUninit();
  34. GameMain.Instance.MainCamera.camera.fieldOfView = this.m_OrijinFov;
  35. }
  36. }
  37. public override void EndAction()
  38. {
  39. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  40. }
  41. [SerializeField]
  42. [Header("移動")]
  43. private float m_MoveSpeed = 5f;
  44. [SerializeField]
  45. [Header("回転")]
  46. private float m_RotSpeed = 30f;
  47. [SerializeField]
  48. [Header("X角度制限")]
  49. private float m_AngleXMax = 45f;
  50. [SerializeField]
  51. [Header("カメラ初期設定")]
  52. private Vector3 m_InitCamPos;
  53. [SerializeField]
  54. private Vector2 m_InitCamRot;
  55. [SerializeField]
  56. private float m_InitDistance;
  57. private Vector3 m_RotAngle;
  58. private float m_OrijinFov;
  59. }