feat: add input action and project setting mappings

This commit is contained in:
2026-08-22 15:55:18 +02:00
parent c702d7b2ab
commit 926b703ace
5 changed files with 81 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
using System;
namespace Game.Godot.Mappings;
public enum InputAction
{
MoveLeft,
MoveRight,
MoveForward,
MoveBack,
Jump,
Cancel
}
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",
_ => throw new ArgumentOutOfRangeException(nameof(action), action, null)
};
}
+1
View File
@@ -0,0 +1 @@
uid://bwrbj8sdi6tqe
+20
View File
@@ -0,0 +1,20 @@
using System;
namespace Game.Godot.Mappings;
public enum ProjectSetting
{
Gravity
}
public static class ProjectSettingExtensions
{
/// <summary>
/// ProjectSettings key for this setting.
/// </summary>
public static string SettingPath(this ProjectSetting setting) => setting switch
{
ProjectSetting.Gravity => "physics/3d/default_gravity",
_ => throw new ArgumentOutOfRangeException(nameof(setting), setting, null)
};
}
+1
View File
@@ -0,0 +1 @@
uid://c6kb654ebimt6