예제 #1
0
    /// <summary>
    /// Retrives the touchpad input of the tool controller and updates the values.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public void GetTouchpadInput(object sender, ClickedEventArgs e)
    {
        Vector2 touchPadPos = new Vector2(e.padX, e.padY);

        TouchpadStatus result = TouchpadStatus.None;

        if (Mathf.Abs(touchPadPos.x) < 0.4f && Mathf.Abs(touchPadPos.y) < 0.4f)
        {
            return;
        }

        if (Mathf.Abs(touchPadPos.x) > Mathf.Abs(touchPadPos.y))
        {
            if (touchPadPos.x > 0)
            {
                result = TouchpadStatus.Right;
            }
            else
            {
                result = TouchpadStatus.Left;
            }
        }
        else
        {
            if (touchPadPos.y > 0)
            {
                result = TouchpadStatus.Top;
            }
            else
            {
                result = TouchpadStatus.Bottom;
            }
        }

        if (e.controllerIndex.Equals(m_SelectorTool.Controller.index))
        {
            SelectorTool_TouchpadStatus = result;
        }
        else if (e.controllerIndex.Equals(m_GUIController.Controller.index))
        {
            GUIController_TouchpadStatus = result;
            m_GUIController.CheckTouchPad(result);
        }
    }