Guest User

Untitled

a guest
Feb 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using HoloToolkit.Unity;
  5. using HoloToolkit.Unity.SpatialMapping;
  6. using HoloToolkit.Unity.InputModule;
  7.  
  8.  
  9. public class ApplicationManager : Singleton<ApplicationManager>, IInputClickHandler, ISpeechHandler
  10. {
  11. public GameObject soundLayer1;
  12. public GameObject soundLayer2;
  13. public GameObject soundLayer3;
  14. public GameObject soundLayer4;
  15.  
  16. public GameObject skeeballmachine;
  17.  
  18. public bool spatialMapSet = false;
  19. public bool skeeBallMachinePlacementSet = false;
  20. public bool toInit = true;
  21.  
  22. // Use this for initialization
  23. void Start ()
  24. {
  25. InputManager.Instance.PushModalInputHandler(this.gameObject);
  26. }
  27.  
  28. // Update is called once per frame
  29. void Update ()
  30. {
  31. if (spatialMapSet)
  32. {
  33. skeeballmachine.SetActive(true);
  34. if (toInit)
  35. {
  36. //this is the first time through only
  37. skeeballmachine.transform.position = Camera.main.transform.position;
  38. skeeballmachine.transform.position += new Vector3(skeeballmachine.transform.position.x, -1.25f, 3.0f);
  39. //we have finished the initiallization of the skeeball machine set the toInit flag to false
  40. toInit = false;
  41. }
  42. }
  43. else
  44. {
  45. skeeballmachine.SetActive(false);
  46. }
  47.  
  48. //if the skeeball machine placement is set then we want to run all of the layers of sound.
  49. if (skeeBallMachinePlacementSet)
  50. {
  51. soundLayer1.SetActive(true);
  52. soundLayer2.SetActive(true);
  53. soundLayer3.SetActive(true);
  54. soundLayer4.SetActive(true);
  55. }
  56. else
  57. {
  58. soundLayer1.SetActive(false);
  59. soundLayer2.SetActive(false);
  60. soundLayer3.SetActive(false);
  61. soundLayer4.SetActive(false);
  62. }
  63. }
  64.  
  65. public void OnInputClicked(InputClickedEventData eventData)
  66. {
  67. SetSpatialMap();
  68. }
  69.  
  70. public void OnSpeechKeywordRecognized(SpeechEventData eventData)
  71. {
  72. switch (eventData.RecognizedText.ToLower())
  73. {
  74. case "done":
  75. SetSpatialMap();
  76. break;
  77. }
  78. }
  79.  
  80. void SetSpatialMap()
  81. {
  82. spatialMapSet = true;
  83. SpatialMappingManager.Instance.DrawVisualMeshes = false;
  84. InputManager.Instance.PopModalInputHandler();
  85. }
  86.  
  87. public void SetSpatialMap(string command)
  88. {
  89. switch (command.ToLower())
  90. {
  91. case "done":
  92. SetSpatialMap();
  93. break;
  94. }
  95. }
  96. }
Add Comment
Please, Sign In to add comment