Ejemplo n.º 1
0
    /// <summary>
    /// Get if a button is released.
    /// </summary>
    /// <param name="_name">Button to check state.</param>
    /// <returns>Returns true if the button is released, false otherwise.</returns>
    public bool GetButtonUp(ButtonType _button)
    {
        TDS_Button _selected = buttons[(int)_button];

        // Get if a key of the button is held
        if (_selected.Keys.Any(k => Input.GetKeyUp(k)))
        {
            return(true);
        }

        // If not, return if the associated input is held
        return(_selected.Axis.LastState == AxisState.KeyUp);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Creates a brand new controller.
    /// </summary>
    public TDS_Controller()
    {
        name = "New Controller";

        AxisType[] _axis = (AxisType[])Enum.GetValues(typeof(AxisType));

        axis = new TDS_AxisToInput[_axis.Length];
        for (int _i = 0; _i < _axis.Length; _i++)
        {
            axis[_i] = new TDS_AxisToInput(_axis[_i].ToString());
        }

        ButtonType[] _buttons = (ButtonType[])Enum.GetValues(typeof(ButtonType));

        buttons = new TDS_Button[_buttons.Length];
        for (int _i = 0; _i < _buttons.Length; _i++)
        {
            buttons[_i] = new TDS_Button(_buttons[_i].ToString());
        }
    }