123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using Nxr.Internal;
- namespace NXR.Samples
- {
- public class FirstScene : MonoBehaviour
- {
- public void JumpToGazeModeScene()
- {
- SceneManager.LoadScene("GazeModeScene");
- }
-
- public void JumpToUIScene()
- {
- SceneManager.LoadScene("UIScene");
- }
-
- public void JumpToInputKeyScene()
- {
- SceneManager.LoadScene("InputKeyScene");
- }
-
- public void JumpToSixdofScene()
- {
- SceneManager.LoadScene("SixdofScene");
- }
-
- public void JumpToCustomCtrlScene()
- {
- SceneManager.LoadScene("CustomCtrlScene");
- }
-
- public void JumpToTeleportScene()
- {
- SceneManager.LoadScene("CameraTeleportScene");
- }
-
- public void JumpToDragScene()
- {
- SceneManager.LoadScene("ControllerDragScene");
- }
-
- public void JumpToSystemApi()
- {
- SceneManager.LoadScene("SystemApi");
- }
-
- public void JumpToServiceScene()
- {
- SceneManager.LoadScene("ServiceScene");
- }
-
- public void JumpToCameraScene()
- {
- SceneManager.LoadScene("CameraScene");
- }
-
- public void JumpToRecordScene()
- {
- SceneManager.LoadScene("RecordScene");
- }
-
- public void JumpToMarkerScene()
- {
- SceneManager.LoadScene("MarkerScene");
- }
-
- public void JumpToSlamScene()
- {
- SceneManager.LoadScene("SlamScene");
- }
- private GameObject gazeObject;
- void OnGazeEvent(GameObject targetObject)
- {
- gazeObject = targetObject;
- // Debug.Log("OnGazeEvent->" + targetObject.name);
- }
- // Use this for initialization
- void Start()
- {
- NxrOverrideSettings.OnGazeEvent += OnGazeEvent;
- }
- // Update is called once per frame
- void Update()
- {
- #if UNITY_EDITOR
- if (gazeObject != null)
- {
- Vector3 start = NxrViewer.Instance.GetHead().transform.position;
- float zLength = gazeObject.transform.position.z - start.z;
- Vector3 vector = NxrViewer.Instance.GetHead().transform.TransformDirection(Vector3.forward);
- UnityEngine.Debug.DrawRay(start, vector * zLength, Color.red);
- }
- #endif
- }
- private void OnDestroy()
- {
- NxrOverrideSettings.OnGazeEvent = OnGazeEvent;
- Debug.Log("FirstScene.OnDestroy");
- }
- }
- }
|