33 lines
806 B
C#
33 lines
806 B
C#
using System;
|
|
|
|
namespace Game.Godot.Mappings;
|
|
|
|
public enum InputAction
|
|
{
|
|
MoveLeft,
|
|
MoveRight,
|
|
MoveForward,
|
|
MoveBack,
|
|
Jump,
|
|
Cancel,
|
|
ToggleConsole
|
|
}
|
|
|
|
public static class InputActionExtensions
|
|
{
|
|
/// <summary>
|
|
/// Godot Input Map action name for this action.
|
|
/// </summary>
|
|
public static string ActionName(this InputAction action) => action switch
|
|
{
|
|
InputAction.MoveLeft => "move_left",
|
|
InputAction.MoveRight => "move_right",
|
|
InputAction.MoveForward => "move_forward",
|
|
InputAction.MoveBack => "move_back",
|
|
InputAction.Jump => "jump",
|
|
InputAction.Cancel => "ui_cancel",
|
|
InputAction.ToggleConsole => "toggle_console",
|
|
_ => throw new ArgumentOutOfRangeException(nameof(action), action, null)
|
|
};
|
|
}
|