ControlPanel.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using SC.XR.Unity.Module_InputSystem;
  5. using SC.XR.Unity.Module_InputSystem.InputDeviceHead;
  6. using SC.XR.Unity;
  7. public class ControlPanel : MonoBehaviour
  8. {
  9. public SCSlider3D WidthSCSlider3D;
  10. public SCSlider3D HeightSCSlider3D;
  11. public SCSlider3D SpeedSCSlider3D;
  12. public SCSlider3D DistanceSCSlider3D;
  13. public SCToggleCheckbox3D InstantFollowing;
  14. public SCToggleCheckbox3D LinearFollowing;
  15. public SCToggleCheckbox3D StopFollower;
  16. public CameraFollower canvas;
  17. // Start is called before the first frame update
  18. void Awake()
  19. {
  20. WidthSCSlider3D?.onValueChanged.AddListener(OnSliderUpdatedWidth);
  21. HeightSCSlider3D?.onValueChanged.AddListener(OnSliderUpdatedHeight);
  22. SpeedSCSlider3D?.onValueChanged.AddListener(OnSliderUpdatedSpeed);
  23. DistanceSCSlider3D?.onValueChanged.AddListener(OnSliderUpdatedDistance);
  24. InstantFollowing.onValueChanged.AddListener(CheckboxInstantFollowing);
  25. LinearFollowing.onValueChanged.AddListener(CheckboxLinearFollowing);
  26. StopFollower.onValueChanged.AddListener(CheckboxStopFollower);
  27. }
  28. private void Start()
  29. {
  30. }
  31. public void OnSliderUpdatedWidth(float value)
  32. {
  33. canvas.menu_size.x = value;
  34. }
  35. public void OnSliderUpdatedHeight(float value)
  36. {
  37. canvas.menu_size.y = value;
  38. }
  39. public void OnSliderUpdatedSpeed(float value)
  40. {
  41. canvas.WindowFollowSpeed = value;
  42. }
  43. public void OnSliderUpdatedDistance(float value)
  44. {
  45. canvas.WindowDistance = value;
  46. }
  47. public void CheckboxInstantFollowing(bool isOn)
  48. {
  49. canvas.InstantFollowing = isOn;
  50. }
  51. public void CheckboxLinearFollowing(bool isOn)
  52. {
  53. canvas.LinearFollowing = isOn;
  54. }
  55. public void CheckboxStopFollower(bool isOn)
  56. {
  57. canvas.StopFollower = isOn;
  58. }
  59. // Update is called once per frame
  60. void Update()
  61. {
  62. }
  63. }