Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
3.0 KiB

  1. // Base Boundaries|SDK_Base|007
  2. namespace VRTK
  3. {
  4. using UnityEngine;
  5. /// <summary>
  6. /// The Base Boundaries SDK script provides a bridge to SDK methods that deal with the play area of SDKs that support room scale play spaces.
  7. /// </summary>
  8. /// <remarks>
  9. /// This is an abstract class to implement the interface required by all implemented SDKs.
  10. /// </remarks>
  11. public abstract class SDK_BaseBoundaries : SDK_Base
  12. {
  13. protected Transform cachedPlayArea;
  14. /// <summary>
  15. /// The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
  16. /// </summary>
  17. public abstract void InitBoundaries();
  18. /// <summary>
  19. /// The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
  20. /// </summary>
  21. /// <returns>A transform of the object representing the play area in the scene.</returns>
  22. public abstract Transform GetPlayArea();
  23. /// <summary>
  24. /// The GetPlayAreaVertices method returns the points of the play area boundaries.
  25. /// </summary>
  26. /// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
  27. public abstract Vector3[] GetPlayAreaVertices();
  28. /// <summary>
  29. /// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
  30. /// </summary>
  31. /// <returns>The thickness of the drawn border.</returns>
  32. public abstract float GetPlayAreaBorderThickness();
  33. /// <summary>
  34. /// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
  35. /// </summary>
  36. /// <returns>Returns true if the play area size has been auto calibrated and set by external sensors.</returns>
  37. public abstract bool IsPlayAreaSizeCalibrated();
  38. /// <summary>
  39. /// The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
  40. /// </summary>
  41. /// <returns>Returns true if the drawn border is being displayed.</returns>
  42. public abstract bool GetDrawAtRuntime();
  43. /// <summary>
  44. /// The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
  45. /// </summary>
  46. /// <param name="value">The state of whether the drawn border should be displayed or not.</param>
  47. public abstract void SetDrawAtRuntime(bool value);
  48. protected Transform GetSDKManagerPlayArea()
  49. {
  50. VRTK_SDKManager sdkManager = VRTK_SDKManager.instance;
  51. if (sdkManager != null && sdkManager.loadedSetup.actualBoundaries != null)
  52. {
  53. cachedPlayArea = (sdkManager.loadedSetup.actualBoundaries ? sdkManager.loadedSetup.actualBoundaries.transform : null);
  54. return cachedPlayArea;
  55. }
  56. return null;
  57. }
  58. }
  59. }