예제 #1
0
    public static InputFeatureUsage <bool> GetUsage(this ButtonInputType inputType)
    {
        switch (inputType)
        {
        case ButtonInputType.PrimaryBtn:
            return(CommonUsages.primaryButton);

        case ButtonInputType.SecondaryBtn:
            return(CommonUsages.secondaryButton);

        default:
            return(CommonUsages.primaryButton);
        }
    }
예제 #2
0
    /// <summary>
    /// Unbinds a function from a button event
    /// </summary>
    /// <param name="InputName"></param>
    /// <param name="InputType"></param>
    /// <param name="ButtonAction"></param>
    public void UnbindActionToInput(string InputName, ButtonInputType InputType, UnityAction ButtonAction)
    {
        if (InputName == null || !ButtonInputNodeDictionary.ContainsKey(InputName))
        {
            Debug.LogWarning("Invalid Button Name: " + InputName);
            return;
        }
        ButtonInputNode ButtonInput = ButtonInputNodeDictionary[InputName];

        switch (InputType)
        {
        case ButtonInputType.Button_Pressed:
            ButtonInput.OnButtonPressed -= ButtonAction;
            break;

        case ButtonInputType.Button_Released:
            ButtonInput.OnButtonReleased -= ButtonAction;
            break;

        case ButtonInputType.Button_Buffer:
            ButtonInput.OnButtonBufferEnded -= ButtonAction;
            break;
        }
    }