Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. namespace HoloToolkit.Unity
  6. {
  7. public class StickToCamera : MonoBehaviour {
  8. GameObject theentrance;
  9. public GameObject[] CurrentLocation;
  10. public GameObject markerfolderlocation;
  11. public GameObject[] CurrentMarker;
  12. public GameObject turnoffShortCut;
  13. // Use this for initialization
  14. void Start() {
  15. this.transform.parent = GameObject.Find("MixedRealityCamera").transform;
  16. theentrance = GameObject.Find("TheEntrance");
  17.  
  18. }
  19.  
  20. // Update is called once per frame
  21. void Update() {
  22. if (theentrance == null)
  23. {
  24. Destroy(this.gameObject);
  25. }
  26. for (int i = 0; i < CurrentLocation.Length; i++)
  27. {
  28. CurrentMarker[i] = markerfolderlocation.transform.GetChild(i).gameObject;
  29. if (CurrentLocation[i].activeSelf == true)
  30. {
  31. CurrentMarker[i].SetActive(true);
  32. }
  33. else
  34. {
  35. CurrentMarker[i].SetActive(false);
  36. CurrentLocation[i].SetActive(false);
  37. }
  38. }
  39. this.transform.SetParent(GameObject.Find("MixedRealityCamera").transform);
  40. this.transform.localPosition = new Vector3(0, 0, 2.5f);
  41. this.transform.rotation = GameObject.Find("MixedRealityCamera").transform.rotation;
  42. // this.transform.LookAt(-GameObject.Find("MixedRealityCamera").transform.position);
  43. }
  44. public void ShutOfOtherLocations()
  45. {
  46. turnoffShortCut.GetComponent<TurnCanvasOff>().j = 2;
  47. for (int j = 0; j < CurrentLocation.Length; j++)
  48. {
  49.  
  50. CurrentLocation[j].SetActive(false);
  51.  
  52. }
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement