Пример #1
0
    private static InputButtonStates GetDesktopButtonState(string _buttonID)
    {
        InputButton       button      = RetrieveButtonByID(_buttonID);
        InputButtonStates buttonState = InputButtonStates.Off;

        if (button != null)
        {
            if (Input.GetButtonDown(_buttonID))
            {
                Debug.LogError("_buttonID: " + _buttonID + "Down");
                buttonState = InputButtonStates.Down;
            }
            else if (Input.GetButton(_buttonID))
            {
                buttonState = InputButtonStates.Pressed;

                Debug.LogError("_buttonID: " + _buttonID + "Pressed");
            }
            else if (Input.GetButtonUp(_buttonID))
            {
                Debug.LogError("_buttonID: " + _buttonID + "Up");

                buttonState = InputButtonStates.Up;
            }
        }

        return(buttonState);
    }
Пример #2
0
    public static void InteractWithButton(string _buttonID, InputButtonStates _newbuttonState)
    {
        InputButton button = RetrieveButtonByID(_buttonID);

        if (button != null)
        {
            button.ChangeButtonState(_newbuttonState);
        }
        return;
    }
Пример #3
0
    public static InputButtonStates GetButtonState(string _buttonID)
    {
        InputButtonStates buttonState = InputButtonStates.Off;

        if (IsOnMobile)
        {
            buttonState = GetVirtualButtonState(_buttonID);
        }
        else
        {
            buttonState = GetDesktopButtonState(_buttonID);
        }

        return(buttonState);
    }
Пример #4
0
    private bool CheckGripButton(InputButtonStates state)
    {
        if (NodeType == XRNode.LeftHand)
        {
            return(ModuleInput.Instance.GetSelectionMethodRift().AuxiliarGripButton(state));
        }

        else if (NodeType == XRNode.RightHand)
        {
            return(ModuleInput.Instance.GetSelectionMethodRift().MainGripButton(state));
        }

        else
        {
            Debug.Log("XRNode type mus be a Hand!  Current type is" + NodeType.ToString());
        }

        return(false);
    }
Пример #5
0
    public bool CheckTriggerButton(InputButtonStates state)
    {
        if (NodeType == XRNode.LeftHand)
        {
            return(Input.GetButton(InputStatics.Auxiliar_Trigger));
        }

        else if (NodeType == XRNode.RightHand)
        {
            return(Input.GetButton(InputStatics.Main_Trigger));
        }


        else
        {
            Debug.Log("XRNode type mus be a Hand!  Current type is" + NodeType.ToString());
        }

        return(false);
    }
Пример #6
0
    public override bool AuxiliarGripButton(InputButtonStates state)
    {
        bool ret = false;

        switch (state)
        {
        case InputButtonStates.UP:
            ret = (Input.GetAxis(InputStatics.Auxiliar_Grip) < 0.2f);
            break;

        case InputButtonStates.DOWN:
            if (Input.GetAxis(InputStatics.Auxiliar_Grip) != 0)
            {
                if (!m_auxGripAxisInUse)
                {
                    m_auxAxisInUse = true;
                    ret            = true;
                }
            }

            if (Input.GetAxisRaw(InputStatics.Auxiliar_Grip) == 0)
            {
                m_auxGripAxisInUse = false;
            }

            break;

        case InputButtonStates.PRESS:
            ret = (Input.GetAxisRaw(InputStatics.Auxiliar_Grip) != 0);
            break;

        case InputButtonStates.NONE:
            break;
        }

        return(ret);
    }
Пример #7
0
    public override bool AuxiliarTiggerButton(InputButtonStates state)
    {
        bool ret = false;

        switch (state)
        {
        case InputButtonStates.UP:
            ret = (Input.GetButtonUp(InputStatics.Auxiliar_Trigger));
            break;

        case InputButtonStates.DOWN:
            ret = (Input.GetButtonDown(InputStatics.Auxiliar_Trigger));
            break;

        case InputButtonStates.PRESS:
            ret = (Input.GetButton(InputStatics.Auxiliar_Trigger));
            break;

        case InputButtonStates.NONE:
            break;
        }

        return(ret);
    }
Пример #8
0
    public override bool MainGripButton(InputButtonStates state)
    {
        bool ret = false;

        switch (state)
        {
        case InputButtonStates.UP:
            ret = (Input.GetButtonUp(InputStatics.Main_Grip));
            break;

        case InputButtonStates.DOWN:
            ret = (Input.GetButtonDown(InputStatics.Main_Grip));
            break;

        case InputButtonStates.PRESS:
            ret = (Input.GetButton(InputStatics.Main_Grip));
            break;

        case InputButtonStates.NONE:
            break;
        }

        return(ret);
    }
Пример #9
0
    public override bool MainTiggerButton(InputButtonStates state)
    {
        bool ret = false;

        switch (state)
        {
        case InputButtonStates.UP:
            ret = (Input.GetAxis(InputStatics.Main_Trigger_Rift) < 0.2f);
            break;

        case InputButtonStates.DOWN:
            if (Input.GetAxis(InputStatics.Main_Trigger_Rift) != 0)
            {
                if (!m_mainAxisInUse)
                {
                    m_mainAxisInUse = true;
                    ret             = true;
                }
            }

            if (Input.GetAxisRaw(InputStatics.Main_Trigger_Rift) == 0)
            {
                m_mainAxisInUse = false;
            }
            break;

        case InputButtonStates.PRESS:
            ret = (Input.GetAxisRaw(InputStatics.Main_Trigger_Rift) != 0);
            break;

        case InputButtonStates.NONE:
            break;
        }

        return(ret);
    }
Пример #10
0
 public bool GetMainTriggerButton(InputButtonStates state)
 {
     return(m_deviceInput.MainTiggerButton(state));
 }
Пример #11
0
 public abstract bool AuxiliarGripButton(InputButtonStates state);
Пример #12
0
 public abstract bool AuxiliarTiggerButton(InputButtonStates state);
Пример #13
0
 public abstract bool MainGripButton(InputButtonStates state);
Пример #14
0
 public abstract bool MainTiggerButton(InputButtonStates state);
 public override bool MainGripButton(InputButtonStates state)
 {
     return(false);
 }
Пример #16
0
 public bool GetAuxiliarTriggerButton(InputButtonStates state)
 {
     return(m_deviceInput.AuxiliarTiggerButton(state));
 }
 public override bool AuxiliarGripButton(InputButtonStates state)
 {
     return(false);
 }
Пример #18
0
 public void ChangeButtonState(InputButtonStates _newState)
 {
     CurrentState = _newState;
     return;
 }