コード例 #1
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        //initializing data collection
        filename = System.DateTime.UtcNow.ToString() + ".txt";
        path     = Path.Combine(Application.persistentDataPath, filename);
        Debug.Log("creating file at: " + path);
        if (!Directory.Exists(path))
        {
            File.Create(path);
        }
        FileStream fs = new FileStream(path, FileMode.Open);

        sw = new StreamWriter(fs);

        // Set up a GestureRecognizer to detect Select gestures.
        recognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        recognizer.TappedEvent += (source, tapCount, ray) =>
        {
            // Send an OnSelect message to the focused object and its ancestors.
            if (FocusedObject != null)
            {
                FocusedObject.SendMessageUpwards("OnSelect");
                sw.WriteLine(FocusedObject.name + " OnSelect");
            }
        };
        recognizer.StartCapturingGestures();
    }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     // Set up a GestureRecognizer to detect Select gestures.
     gestureRecognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
     gestureRecognizer.TappedEvent += GestureRecognizer_TappedEvent;
     gestureRecognizer.StartCapturingGestures();
 }
コード例 #3
0
    /// <summary>

    /// Transition to a new GestureRecognizer.

    /// </summary>

    /// <param name="newRecognizer">The GestureRecognizer to transition to.</param>

    public void Transition(UnityEngine.XR.WSA.Input.GestureRecognizer newRecognizer)

    {
        if (newRecognizer == null)

        {
            return;
        }



        if (ActiveRecognizer != null)

        {
            if (ActiveRecognizer == newRecognizer)

            {
                return;
            }



            ActiveRecognizer.CancelGestures();

            ActiveRecognizer.StopCapturingGestures();
        }



        newRecognizer.StartCapturingGestures();

        ActiveRecognizer = newRecognizer;
    }
コード例 #4
0
    void Awake()
    {
        transforms = new List <Transform>();
        Transform[] tempTransforms = FaceMesh.GetComponentsInChildren <Transform>();
        for (int i = 0; i < tempTransforms.Length; i++)
        {
            if (tempTransforms[i].parent == FaceMesh.transform)
            {
                transforms.Add(tempTransforms[i]);
            }
        }
#if WINDOWS_UWP
        for (int i = 0; i < transforms.Count; i++)
        {
            transforms[i].gameObject.SetActive(false);
        }
#endif
        gestureRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        gestureRecognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);
        gestureRecognizer.TappedEvent += NextItem;
        gestureRecognizer.StartCapturingGestures();

#if WINDOWS_UWP
        HideFace();
#else
        ShowFace();
#endif
        transforms[currentItem].gameObject.SetActive(true);
    }
コード例 #5
0
ファイル: GestureManager.cs プロジェクト: ralp99/starcrab
    /// <summary>
    /// Transition to a new GestureRecognizer.
    /// </summary>
    /// <param name="newRecognizer">The GestureRecognizer to transition to.</param>
    public void Transition(UnityEngine.XR.WSA.Input.GestureRecognizer newRecognizer)
    {
        // GRAB EVENT works nowhere in here!!!!! ----------------------------------------------------

        // ReleasedEvent.Invoke();  // Cant use it here, just keeps blinking

        // print("TRANSITION");

        if (newRecognizer == null)
        {
            //   ReleasedEvent.Invoke(); // no effect here
            return;
        }

        if (ActiveRecognizer != null)
        {
            if (ActiveRecognizer == newRecognizer)
            {
                //   ReleasedEvent.Invoke();  // blinks here too

                return;
            }

            ActiveRecognizer.CancelGestures();
            ActiveRecognizer.StopCapturingGestures();

            //   ReleasedEvent.Invoke();  does nothing here
        }

        //   ReleasedEvent.Invoke();  // does nothing


        newRecognizer.StartCapturingGestures();
        ActiveRecognizer = newRecognizer;
    } // END TRANSITION
コード例 #6
0
ファイル: GamePlay.cs プロジェクト: Trojka/HoloPingus
    // Use this for initialization
    void Start()
    {
        _behaviour = this.GetComponent <CreatureManager>();

        _gameState = GameState.Scanning;

        StartPositionMarker.SetActive(false);
        EndPositionMarker.SetActive(false);

        _gestureRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        _gestureRecognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);
        _gestureRecognizer.TappedEvent += _gestureRecognizer_TappedEvent;

        SpatialMappingManager.Instance.StartObserver();

        if (Testing)
        {
            StartPositionMarker.SetActive(true);
            EndPositionMarker.SetActive(true);

            StartPositionMarker.transform.position = new Vector3(0, 0, 1);
            EndPositionMarker.transform.position   = new Vector3(0, 0, 0);

            _scanTime  = 0.0f;
            _gameState = GameState.StartPlaying;
        }
    }
コード例 #7
0
ファイル: GestureManager.cs プロジェクト: Herrandy/HRC-TUNI
    // public Source sc;

    void Awake()
    {
        HoverRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();

        HoverRecognizer.TappedEvent += (source, tapCount, ray) =>
        {
            if (InteractibleManager.Instance.FocusedGameObject != null)
            {
                InteractibleManager.Instance.FocusedGameObject.SendMessageUpwards("OnTapped");
            }
        };
        HoverRecognizer.StartCapturingGestures();

        // Instantiate the ManipulationRecognizer.
        ManipulationRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();

        // Add the ManipulationTranslate GestureSetting to the ManipulationRecognizer's RecognizableGestures.
        ManipulationRecognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.ManipulationTranslate);

        // Register for the Manipulation events on the ManipulationRecognizer.
        ManipulationRecognizer.ManipulationStartedEvent   += ManipulationRecognizer_ManipulationStartedEvent;
        ManipulationRecognizer.ManipulationUpdatedEvent   += ManipulationRecognizer_ManipulationUpdatedEvent;
        ManipulationRecognizer.ManipulationCompletedEvent += ManipulationRecognizer_ManipulationCompletedEvent;
        ManipulationRecognizer.ManipulationCanceledEvent  += ManipulationRecognizer_ManipulationCanceledEvent;

        ResetGestureRecognizers();
    }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        // Set up a GestureRecognizer to detect Select gestures.
        gesture_recognizer_              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        gesture_recognizer_.TappedEvent += (source, tapCount, ray) =>
        {
            if (!_processing)
            {
                _processing = true;
                status.GetComponent <TextMesh>().text = "Photo taken !";
                status.SetActive(true);
                UnityEngine.XR.WSA.WebCam.PhotoCapture.CreateAsync(false, OnPhotoCaptureCreated);
            }
            else
            {
                status.GetComponent <TextMesh>().text = "Please wait...";
                status.SetActive(true);
            }
        };
        gesture_recognizer_.StartCapturingGestures();
        status.GetComponent <TextMesh>().text = "Photo taken !";
        _processing = true;

        UnityEngine.XR.WSA.WebCam.PhotoCapture.CreateAsync(false, OnPhotoCaptureCreated);

        // Décommenter la partie suivante pour une execution en temps réel.
        // InvokeRepeating("OnPhotoCaptureCreated", 5, 2);
    }
コード例 #9
0
    // Use this for initialization
    void Awake()
    {
        Instance      = this;
        this.textMesh = this.textMeshObject.GetComponent <TextMesh>();
        audiosource   = GetComponent <AudioSource>();
        // Set up a GestureRecognizer to detect Select gestures.
        TapRecognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        ManipulationRecognizer     = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        TapRecognizer.TappedEvent += (source, tapCount, ray) =>
        {
            // Send an OnSelect message to the focused object and its ancestors.
            if (FocusedObject != null)
            {
                FocusedObject.SendMessageUpwards("OnSelect");
                Debug.Log("On select called: " + FocusedObject.name);
            }
            else
            {
                Debug.Log("Focused object is null");
            }
        };
        ManipulationRecognizer.SetRecognizableGestures(
            UnityEngine.XR.WSA.Input.GestureSettings.ManipulationTranslate);

        ManipulationRecognizer.ManipulationStartedEvent   += ManipulationRecognizer_ManipulationStartedEvent;
        ManipulationRecognizer.ManipulationUpdatedEvent   += ManipulationRecognizer_ManipulationUpdatedEvent;
        ManipulationRecognizer.ManipulationCompletedEvent += ManipulationRecognizer_ManipulationCompletedEvent;
        ManipulationRecognizer.ManipulationCanceledEvent  += ManipulationRecognizer_ManipulationCanceledEvent;

        TapRecognizer.StartCapturingGestures();
        ManipulationRecognizer.StartCapturingGestures();
    }
コード例 #10
0
 // Use this for initialization
 void Start()
 {
     recognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
     recognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);
     recognizer.TappedEvent += Recognizer_TappedEvent;
     recognizer.StartCapturingGestures();
 }
コード例 #11
0
    void Awake()
    {
        ins        = this;
        transforms = new List <Transform>();
        Transform[] tempTransforms = FaceMesh.GetComponentsInChildren <Transform>();
        for (int i = 0; i < tempTransforms.Length; i++)
        {
            if (tempTransforms[i].parent == FaceMesh.transform)
            {
                transforms.Add(tempTransforms[i]);
                peopleItems.Add(tempTransforms[i].name, tempTransforms[i].gameObject);
            }
        }
#if WINDOWS_UWP
        for (int i = 0; i < transforms.Count; i++)
        {
            transforms[i].gameObject.SetActive(false);
        }
        gestureRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        gestureRecognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);
        gestureRecognizer.TappedEvent += ((a, b, c) => StartCoroutine("ProcessPicture"));
        gestureRecognizer.StartCapturingGestures();
#endif

#if WINDOWS_UWP
        HideFace();
#else
        ShowFace();
#endif
    }
コード例 #12
0
 void Awake()
 {
     // Create and set the gesture recognizer
     _gestureRecognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
     _gestureRecognizer.TappedEvent += (source, tapCount, headRay) => { Debug.Log("Tapped"); StartCoroutine(StopVideoMode()); };
     _gestureRecognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);
     _gestureRecognizer.StartCapturingGestures();
 }
コード例 #13
0
ファイル: GazeGestureManager.cs プロジェクト: hyunatic/QRCODE
 void Awake()
 {
     Instance                       = this;
     photoInput                     = GetComponent <PhotoInput>();
     gestureRecognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
     gestureRecognizer.TappedEvent += GestureRecognizer_TappedEvent;
     gestureRecognizer.StartCapturingGestures();
     qrDecoder = gameObject.AddComponent <QrDecoder>();
 }
コード例 #14
0
    /// <summary>
    /// Unity Monobehavior function. Initialize the click detection, and callback registration. 
    /// [internal use]
    /// </summary>
    void Awake() {
        Instance = this;

        // Set up a GestureRecognizer to detect Select gestures.
        recognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        recognizer.TappedEvent += (source, tapCount, ray) => {
            eventClickerClick.Invoke();
        };
        recognizer.StartCapturingGestures();
    }
コード例 #15
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        // Set up a GestureRecognizer to detect Select gestures.
        _recognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        _recognizer.TappedEvent += Recognizer_TappedEvent;

        _recognizer.StartCapturingGestures();
    }
コード例 #16
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        // Set up a GestureRecognizer to detect Select gestures.
        recognizer              = new GestureRecognizer();
        recognizer.TappedEvent += OnTappedEvent;
        //recognizer.HoldStartedEvent += OnHoldStartedEvent;
        recognizer.StartCapturingGestures();
    }
コード例 #17
0
 // Use this for initialization
 void Start()
 {
     recognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
     recognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);
     recognizer.TappedEvent += Recognizer_TappedEvent;
     recognizer.StartCapturingGestures();
     throwNewBall();
     //hand.transform.Rotate(0, -Time.deltaTime * speedofhand,0);
     //hand.transform.Rotate(0.0f, 40.0f, 0.0f);
 }
コード例 #18
0
    // Use this for initialization
    void Awake()
    {
        Instance = this;

        // Set up a GestureRecognizer to detect Select gestures.
        recognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        recognizer.TappedEvent += (source, tapCount, ray) => {
            // Debug.Log(TAG + ": clicker event triggered");
            //   status.text = count.ToString();
            count += 1;
            GetComponent <GetTransform>().count = count;
            eventClickerClick.Invoke();
        };
        recognizer.StartCapturingGestures();
    }
コード例 #19
0
ファイル: HTGestureManager.cs プロジェクト: gaviral/Holobrain
    void Start()
    {
        // Create a new GestureRecognizer. Sign up for tapped events.

        gestureRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        gestureRecognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);

        gestureRecognizer.TappedEvent += GestureRecognizer_TappedEvent;

        // Start looking for gestures.
        gestureRecognizer.StartCapturingGestures();

        brainParts   = GameObject.Find("BrainParts");
        dataRecorder = (DataRecorder)FindObjectOfType(typeof(DataRecorder));
    }
コード例 #20
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        // Set up a GestureRecognizer to detect Select gestures.
        recognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        recognizer.TappedEvent += (source, tapCount, ray) =>
        {
            // Send an OnSelect message to the focused object and its ancestors.
            if (FocusedObject != null)
            {
                FocusedObject.SendMessageUpwards("OnSelect");
            }
        };
        recognizer.StartCapturingGestures();
    }
コード例 #21
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     camera     = GetComponent <Camera>();
     recognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
     recognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);
     recognizer.TappedEvent += OnAirTap;
     recognizer.StartCapturingGestures();
     FaceLazers            = GetComponentsInChildren <LineRenderer>();
     FaceLazers[0].enabled = false;
     FaceLazers[1].enabled = false;
     lazersOn = false;
 }
コード例 #22
0
    protected override void Awake()
    {
        base.Awake();
        UnityEngine.XR.WSA.Input.InteractionManager.InteractionSourceDetected += InteractionManager_SourceDetected;
        UnityEngine.XR.WSA.Input.InteractionManager.InteractionSourceLost     += InteractionManager_SourceLost;
        UnityEngine.XR.WSA.Input.InteractionManager.InteractionSourceUpdated  += InteractionManager_SourceUpdated;

        recognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        recognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Hold);
        recognizer.HoldStartedEvent += SwitchAllowTrack;
        recognizer.StartCapturingGestures();

        if (handednessOffsetObj != null)
        {
            rightHandLocalPos = handednessOffsetObj.transform.localPosition;
        }
    }
コード例 #23
0
    private void DismissFitbox()
    {
        // Destroy the GestureRecognizer ...
        recognizer.CancelGestures();
        recognizer.StopCapturingGestures();
        recognizer.Dispose();
        recognizer = null;

        // ... show the hologram collection ...
        if (HologramCollection)
        {
            HologramCollection.SetActive(true);
            Menu.SetActive(true);

            if (MoveCollectionOnDismiss)
            {
                // Update the Hologram Collection's position so it shows up
                // where the Fitbox left off. Start with the camera's localRotation...
                camQuat = Camera.main.transform.localRotation;

                // ... ignore pitch by disabling rotation around the x axis
                camQuat.x = 0;
                camQuat.z = 0;

                // Rotate the vector and factor y back into the position
                newPosition   = camQuat * collectionStartingOffsetFromCamera;
                newPosition.y = collectionStartingOffsetFromCamera.y;

                // Position was "Local Position" so add that to where the camera is now
                cameraPosition = Camera.main.transform.position;
                HologramCollection.transform.position = cameraPosition + newPosition;

                // Rotate the Hologram Collection to face the user.
                toQuat   = Camera.main.transform.localRotation * HologramCollection.transform.rotation;
                toQuat.x = 0;
                toQuat.z = 0;
                HologramCollection.transform.rotation = toQuat;
            }
        }

        // ... and Destroy the Fitbox
        //Destroy(gameObject);
        gameObject.SetActive(false);
        GameObject.Find("Manager").GetComponent <Load>().FileNumber = 0;
    }
コード例 #24
0
    void Start()
    {
        camera = Camera.main;

        // Hook up air tap
        gestures              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        gestures.TappedEvent += OnTap;
        gestures.StartCapturingGestures();

        // Hook up voice
        keywords.Add("repeat", () =>
        {
            if (stepController)
            {
                stepController.SkipBackward();
            }
        });

        keywords.Add("next", () => {
            if (stepController)
            {
                stepController.SkipForward();
            }
        });

        keywords.Add("start over", () => {
            if (stepController)
            {
                stepController.Restart();
            }
        });

        keywords.Add("reposition", () => {
            if (stepController)
            {
                stepController.Reposition();
            }
        });

        keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray());
        keywordRecognizer.OnPhraseRecognized += OnKeyword;
        keywordRecognizer.Start();
    }
コード例 #25
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        // Set up a GestureRecognizer to detect Select gestures.
        recognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        recognizer.TappedEvent += (source, tapCount, ray) =>
        {
            // Send an OnSelect message to the focused object and its ancestors.
            if (FocusedObject != null)
            {
                if (FocusedObject.gameObject.tag == "FridgeLowerDoor")
                {
                    FocusedObject.gameObject.SetActive(false);
                    popUp.gameObject.SetActive(true);
                }
            }
        };
        recognizer.StartCapturingGestures();
    }
コード例 #26
0
    private void Start()
    {
        tapRecognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        tapRecognizer.TappedEvent += (source, tapCount, ray) =>
        {
            if (FocusedObject != null)
            {
                //JustToDebug.text = FocusedObject.name + " is clicked";
                //Debug.Log(FocusedObject);
                if (FocusedObject.tag != "TransformMenu")
                {
                    SetSelectedGameObject(FocusedObject);
                }
            }
        };

        if (AutoSelect)
        {
            tapRecognizer.StartCapturingGestures();
        }
    }
コード例 #27
0
    private void Start()
    {
        _gestureRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        _gestureRecognizer.SetRecognizableGestures(UnityEngine.XR.WSA.Input.GestureSettings.Tap);
        _gestureRecognizer.TappedEvent += Recognizer_TappedEvent;
        _gestureRecognizer.StartCapturingGestures();

        _keywordDictionary = new Dictionary <string, KeywordAction>();

        _keywordDictionary.Add("Stand idle", StandIdleCommand);
        _keywordDictionary.Add("Show me a backflip", BackflipCommand);
        _keywordDictionary.Add("How do I block", BlockingCommand);
        _keywordDictionary.Add("How about kick", KickCommand);
        _keywordDictionary.Add("I want to learn Capoeira", CapoeiraCommand);
        _keywordDictionary.Add("I want to learn dancing", SambaDanceCommand);
        _keywordDictionary.Add("Thank you very much", BowCommand);


        _keywordRecognizer = new KeywordRecognizer(_keywordDictionary.Keys.ToArray());
        _keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized;
        _keywordRecognizer.Start();
    }
コード例 #28
0
ファイル: GestureManager.cs プロジェクト: FlowerSmile0010/ss
    void Awake()
    {
        /* TODO: DEVELOPER CODING EXERCISE 2.b */

        // 2.b: Instantiate the NavigationRecognizer.
        NavigationRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();

        // 2.b: Add Tap and NavigationX GestureSettings to the NavigationRecognizer's RecognizableGestures.
        NavigationRecognizer.SetRecognizableGestures(
            UnityEngine.XR.WSA.Input.GestureSettings.Tap |
            UnityEngine.XR.WSA.Input.GestureSettings.NavigationX);

        // 2.b: Register for the TappedEvent with the NavigationRecognizer_TappedEvent function.
        NavigationRecognizer.TappedEvent += NavigationRecognizer_TappedEvent;
        // 2.b: Register for the NavigationStartedEvent with the NavigationRecognizer_NavigationStartedEvent function.
        NavigationRecognizer.NavigationStartedEvent += NavigationRecognizer_NavigationStartedEvent;
        // 2.b: Register for the NavigationUpdatedEvent with the NavigationRecognizer_NavigationUpdatedEvent function.
        NavigationRecognizer.NavigationUpdatedEvent += NavigationRecognizer_NavigationUpdatedEvent;
        // 2.b: Register for the NavigationCompletedEvent with the NavigationRecognizer_NavigationCompletedEvent function.
        NavigationRecognizer.NavigationCompletedEvent += NavigationRecognizer_NavigationCompletedEvent;
        // 2.b: Register for the NavigationCanceledEvent with the NavigationRecognizer_NavigationCanceledEvent function.
        NavigationRecognizer.NavigationCanceledEvent += NavigationRecognizer_NavigationCanceledEvent;

        // Instantiate the ManipulationRecognizer.
        ManipulationRecognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();

        // Add the ManipulationTranslate GestureSetting to the ManipulationRecognizer's RecognizableGestures.
        ManipulationRecognizer.SetRecognizableGestures(
            UnityEngine.XR.WSA.Input.GestureSettings.ManipulationTranslate);

        // Register for the Manipulation events on the ManipulationRecognizer.
        ManipulationRecognizer.ManipulationStartedEvent   += ManipulationRecognizer_ManipulationStartedEvent;
        ManipulationRecognizer.ManipulationUpdatedEvent   += ManipulationRecognizer_ManipulationUpdatedEvent;
        ManipulationRecognizer.ManipulationCompletedEvent += ManipulationRecognizer_ManipulationCompletedEvent;
        ManipulationRecognizer.ManipulationCanceledEvent  += ManipulationRecognizer_ManipulationCanceledEvent;

        ResetGestureRecognizers();
    }
コード例 #29
0
    /// <summary>
    /// Initialization of recognizers
    /// </summary>
    void Awake()
    {
        Instance = this;

        //___________Action________________
        recognizer = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        //StartCapturingAirTap();
        recognizer.TappedEvent += TappedEvent;

        //Manipulation
        recognizer.ManipulationStartedEvent   += ManipulationStartedEvent;
        recognizer.ManipulationUpdatedEvent   += ManipulationUpdatedEvent;
        recognizer.ManipulationCompletedEvent += ManipulationEndedEvent;
        recognizer.ManipulationCanceledEvent  += ManipulationEndedEvent;

        //Navigation
        recognizer.NavigationStartedEvent   += NavigationStartedEvent;
        recognizer.NavigationUpdatedEvent   += NavigationUpdatedEvent;
        recognizer.NavigationCompletedEvent += NavigationEndedEvent;
        recognizer.NavigationCanceledEvent  += NavigationEndedEvent;

        recognizer.StartCapturingGestures();
    }
コード例 #30
0
    private void Awake()
    {
#if UNITY_EDITOR
        // If we are running inside Unity's Editor, disable the Fitbox script
        // as there is no easy way to dismiss it to see our actual holograms.
        enabled = false;
#else // !UNITY_EDITOR
        // These are the holograms to show when the Fitbox is dismissed
        if (HologramCollection)
        {
            collectionStartingOffsetFromCamera = HologramCollection.transform.localPosition;
            HologramCollection.SetActive(false);
        }

        // Set up our GestureRecognizer to listen for the SelectEvent
        recognizer              = new GestureRecognizer();
        recognizer.TappedEvent += (source, tapCount, ray) =>
        {
            DismissFitbox();
        };
        recognizer.StartCapturingGestures();
#endif
    }