예제 #1
0
    //  -   -   -   STATIC METHODS  -   -   -   //

    public static InputFeatureUsage <bool> GetFeature(CommonFeaturesString s)
    {
        if (s == CommonFeaturesString.trigger)
        {
            return(CommonUsages.triggerButton);
        }

        if (s == CommonFeaturesString.primary2DAxisClick)
        {
            return(CommonUsages.primary2DAxisClick);
        }

        if (s == CommonFeaturesString.grip)
        {
            return(CommonUsages.gripButton);
        }
        return(new InputFeatureUsage <bool>());//not totally sure what will happen here, but I'm fairly certain that there's no way that a controller will have this arbitrary feature usage...
    }
예제 #2
0
    //probably an opportinuty for imporvement, since I'm getting the controller and checking if it exists for every button
    public static bool ButtonCheck(InputDeviceRole role, CommonFeaturesString inputFeatureUsage)
    {
        var device = new List <InputDevice>();

        InputDevices.GetDevicesWithRole(role, device);

        if (device.Count > 0)
        {
            if (device[0].TryGetFeatureValue(GetFeature(inputFeatureUsage), out bool controlValue))
            {
                return(controlValue);
            }
            else
            {
                Debug.LogError("Match3_Cube: attempted to get a button which is not acessible on this controller!");
                return(false);
            }
        }
        return(false);
    }