Exemplo n.º 1
0
        public float GetAxis(string action)
        {
            for (var i = 0; i < inputMap.inputs.Count; i++)
            {
                WebXRControllerInput input = inputMap.inputs[i];
                if (action == input.actionName)
                {
                    if (OUalt.isPresent() && !input.unityInputIsButton)
                    {
                        return(Input.GetAxis(input.unityInputName));
                    }

                    if (!input.gamepadIsButton)
                    {
                        return(axes[i]);
                    }

                    if (!buttonStates.ContainsKey(action))
                    {
                        return(0);
                    }
                    return(buttonStates[action].value);
                }
            }

            return(0);
        }
Exemplo n.º 2
0
                        return(axes[i]);                                        /**/
                    }
                    if (!buttonStates.ContainsKey(action))
                    {
                        return(0);
                    }
                    return(buttonStates[action].value);
                }
            }

            return(0);
        }

        /**/
        public Vector2 Get2DAxis(string action)
        {
            for (var i = 0; i < inputMap.inputs.Count; i++)
            {
                WebXRControllerInput input = inputMap.inputs[i];
                if (action == input.actionName)
                {
                    // No Unity Editor counterpart for this function
                    //if (XRDevice.isPresent && !input.unityInputIsButton) { return Input.GetAxis(input.unityInputName); }
                    if (!input.gamepadIsButton && axes != null)
                    {
                        if (textUI != null)
                        {
                            textUI.text = hand.ToString() + "axes ->";
                            for (int j = 0; j < axes.Length; j++)
                            {
                                textUI.text += " " + j + ": " + axes[j].ToString("0.00");
                            }
                        }

                        return(new Vector2(axes[2], axes[3]));
                    }

                    if (!buttonStates.ContainsKey(action))
                    {
                        return(Vector2.zero);
                    }
                    return(Vector2.zero);
                }
            }

            return(Vector2.zero);
        }
Exemplo n.º 3
0
        public float GetAxis(string action)
        {
            for (var i = 0; i < inputMap.inputs.Count; i++)
            {
                WebXRControllerInput input = inputMap.inputs[i];
                if (action == input.actionName)
                {
                    if (XRDevice.isPresent && !input.unityInputIsButton)
                    {
                        return(Input.GetAxis(input.unityInputName));
                    }

                    if (!input.gamepadIsButton && axes != null)
                    {
                        return(axes[i]);                                        /**/
 public float GetAxis(string action)
 {
     for (var i = 0; i < inputMap.inputs.Count; i++)
     {
         WebXRControllerInput input = inputMap.inputs[i];
         if (action == input.actionName)
         {
             if (input.gamepadIsButton)
             {
                 if (!buttonStates.ContainsKey(action))
                 {
                     return(0);
                 }
                 return(buttonStates[action].value);
             }
             else
             {
                 return(axes[i]);
             }
         }
     }
     return(0);
 }