public string GetAxisName (GamepadAxis axis) { for (int i = 0; i < axisNames.Count; i++) { if (axisNames [i].axis == axis) return axisNames [i].name; } return axis.ToString (); }
public string GetAxisName(GamepadAxis axis) { for (int i = 0; i < axisNames.Count; i++) { if (axisNames [i].axis == axis) { return(axisNames [i].name); } } return(axis.ToString()); }
public string GetAsString(bool usePositive) { switch (m_type) { case InputType.KeyButton: return(m_positive.ToString()); case InputType.MouseAxis: return(mouseAxisNames[mouseAxis]); case InputType.DigitalAxis: return(usePositive ? m_positive.ToString() : m_negative.ToString()); case InputType.GamepadButton: return(m_gamepadButton.ToString()); case InputType.GamepadAnalogButton: return((useNegativeAxisForButton ? "-" : "+") + GamepadAxis.ToString()); case InputType.GamepadAxis: return(GamepadAxis.ToString()); } return("ERROR"); }
public void AddAxis(string a_buttonName, GamepadAxis a_axis, float a_deadzone, bool a_inverted = false) { InputAction action = new InputAction { name = a_buttonName, inputType = InputType.Axis, axisName = a_axis.ToString(), deadzone = a_deadzone, inverted = a_inverted }; var id = GetId(a_buttonName); if (id != -1) { m_inputList[id] = action; } else { m_inputList.Add(action); } }
private static string GetPromptImagePath(this GamepadAxis axis, GamepadType type) { if (type == GamepadType.Unknown) { type = GamepadType.Xbox360; } string buttonName; switch (axis) { case GamepadAxis.LeftStickX: case GamepadAxis.LeftStickY: { buttonName = "left_stick"; break; } case GamepadAxis.RightStickX: case GamepadAxis.RightStickY: { buttonName = "right_stick"; break; } default: { buttonName = axis.ToString().ToLowerUnderscored(); break; } } return(AssetPath.Combine( "gui/prompts/" + type.ToString().ToLowerUnderscored(), buttonName + ".png" )); }