コード例 #1
0
    public static bool GetDown(VRButton input)
    {
        //if cast results in different value then inputs are mutually exclusive
        VRAxis axisInput = (VRAxis)input;

        if (axisInput.ToString() == input.ToString())   //input is also an axis

        {
            if (GetAxisRaw(axisInput) > 0)
            {
                //input recieved
                if (axisAvailable[axisInput])
                {
                    //input is new (wasn't previously being held
                    axisAvailable[axisInput] = false;
                    return(true);
                }
            }
        }
        else   //input is a button
        {
            return(Input.GetButtonDown(input.ToString()));
        }

        return(false);
    }
コード例 #2
0
    public static bool GetUp(VRButton input)
    {
        VRAxis axisInput = (VRAxis)input;

        if (axisInput.ToString() == input.ToString())
        {
            //input is also an axis
            if (GetAxisRaw(axisInput) <= 0)
            {
                //input not recieved
                if (axisWasBeingHeld[axisInput])
                {
                    //input is new (wasn't previously being held
                    axisWasBeingHeld[axisInput] = false;
                    return(true);
                }
            }
        }
        else
        {
            return(Input.GetButtonUp(input.ToString()));
        }

        return(false);
    }
コード例 #3
0
        private void AxesStateLabel(VRButton button)
        {
            var axes = VRInput.GetAxes(button);

            UnityGUI.Label(button.ToString() + " X: " + axes[0].ToString("0.000"));
            UnityGUI.Label(button.ToString() + " Y: " + axes[1].ToString("0.000"));
        }
コード例 #4
0
        private void ButtonStateLabel(VRButton button)
        {
            var state = "Up";

            if (VRInput.GetButton(button))
            {
                state = "Down";
            }
            else if (VRInput.GetTouch(button))
            {
                state = "Touching";
            }
            else if (VRInput.GetHovering(button) > Mathf.Epsilon)
            {
                state = "Hovering";
            }

            UnityGUI.Label(button.ToString() + ": " + state);
        }
コード例 #5
0
 public static bool Get(VRButton input)
 {
     return(Input.GetAxisRaw(input.ToString()) > 0);
 }
コード例 #6
0
ファイル: VRInput.cs プロジェクト: mbding98/Spear-Game
 public static float GetAxisRaw(VRButton input)
 {
     return(Input.GetAxisRaw(input.ToString()));
 }
コード例 #7
0
 private void AxisStateLabel(VRButton button)
 {
     UnityGUI.Label(button.ToString() + ": " + VRInput.GetAxis(button).ToString("0.000"));
 }