Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (CurrentSource != null)
        {
            SourceHand   = CurrentSource.GetHandedness();
            J_Title.text = "Controller input source :" + SourceHand;

            // Example to get button states from the source.
            J_CurrentSelectTryGetButton.text   = "TryGetSelect() :" + CurrentSource.TryGetSelect().ToString();
            J_CurrentBackTryGetButton.text     = "TryGetBack() :" + CurrentSource.TryGetBack().ToString();
            J_CurrentHomeTryGetButton.text     = "TryGetHome() :" + CurrentSource.TryGetHome().ToString();
            J_CurrentFunctionTryGetButton.text = "TryGetFunctionButton() :" + CurrentSource.TryGetFunctionButton().ToString();

            // Example to get source rotation
            if (CurrentSource.TryGetRotation(out SourceRotation))
            {
                J_CurrentSourceRotation.text = "TryGetRotation(out SourceRotation) :" + SourceRotation.ToString();
            }

            //Example to get source position
            //NOTE: current Source doesn't provide positional data
            if (CurrentSource.TryGetPosition(out SourcePosition))
            {
                J_CurrentSourcePosition.text = "TryGetPosition(out SourcePosition) :" + SourcePosition.ToString();
            }
        }
        else
        {
            if (CurrentSource == null)
            {
                CurrentSource = JMRInteractionManager.Instance.GetCurrentSource();
            }

            // CurrentSource = JMRInteractionManager.Instance.GetSourceByHandedness(Handedness.Right);
        }
    }