예제 #1
0
    public string GetActionText(string action)
    {
        ControlScheme scheme        = InputManager.PlayerOneControlScheme;
        InputAction   inputAction   = scheme.GetAction(action);
        InputBinding  actionBinding = inputAction.GetBinding(0);
        KeyCode       code          = actionBinding.Positive;

        return(GetInputText(code));
    }
예제 #2
0
    public Sprite GetActionIcon(string action)
    {
        ControlScheme scheme        = InputManager.PlayerOneControlScheme;
        InputAction   inputAction   = scheme.GetAction(action);
        InputBinding  actionBinding = inputAction.GetBinding(0);
        KeyCode       code          = actionBinding.Positive;
        int           axis          = actionBinding.Axis;
        bool          pos           = actionBinding.Invert;

        return(GetInputIcon(code) ?? GetInputAxisIcon(axis, pos));
    }
 protected bool GetValues(out InputAction inputAction, out InputBinding inputBinding)
 {
     inputAction  = InputManager.GetAction(m_controlSchemeName, actionName);
     inputBinding = null;
     if (inputAction != null)
     {
         inputBinding = inputAction.GetBinding(m_bindingIndex);
     }
     if (inputAction == null || inputBinding == null)
     {
         Debug.LogErrorFormat("Control scheme '{0}' does not exist or input action '{1}' does not exist", m_controlSchemeName, actionName);
         return(false);
     }
     return(true);
 }