Exemple #1
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);
    }
Exemple #2
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);
    }
Exemple #3
0
    //equivalent to GetButtonDown, but for axes
    public static float GetAxisOnce(VRAxis axisInput, float?inputThreshold = 0.75f)
    {
        float rawAxisIn = GetAxisRaw(axisInput);

        if (Mathf.Abs(rawAxisIn) > inputThreshold)
        {
            //input recieved
            if (axisAvailable[axisInput])
            {
                //input is new (wasn't previously being held
                axisAvailable[axisInput] = false;
                return(Mathf.RoundToInt(rawAxisIn));
            }
        }

        return(0);
    }
Exemple #4
0
 public static float GetAxisRaw(VRAxis input)
 {
     return(Input.GetAxisRaw(input.ToString()));
 }
Exemple #5
0
    public static float GetAxisOnce(GenericVRAxis axisInput, Handedness handedness, float?inputThreshold = 0.75f)
    {
        VRAxis vrAxis = (VRAxis)Enum.Parse(typeof(VRAxis), handedness.ToString() + axisInput.ToString());

        return(GetAxisOnce(vrAxis, inputThreshold));
    }