Game.Input.ActionComponent
Assembly:
Namespace: Game.Input
Type: enum
Base: System.Enum
Summary: Represents discrete input action components used by the game's input system. Each member describes a semantic input state or direction (e.g., button Press, axis Positive/Negative, directional inputs). Mods can use this enum when inspecting or describing input bindings and interpreting user input events.
Fields
-
None
Represents no action or an undefined/neutral component. Use when no input is associated or as a default value. -
Press
Represents a generic button press event (single activation). Common for momentary actions like selecting or confirming. -
Negative
Represents the negative side of an axis (for example, left on a horizontal axis or down on a vertical axis). -
Positive
Represents the positive side of an axis (for example, right on a horizontal axis or up on a vertical axis). -
Down
Direction-specific input: down direction (often used for vertical movement or menu navigation). -
Up
Direction-specific input: up direction. -
Left
Direction-specific input: left direction. -
Right
Direction-specific input: right direction.
Properties
- This enum type does not declare instance properties. It inherits standard enum behavior from System.Enum. {{ Use System.Enum methods (ToString, GetValues, Parse) to work with enum values when needed. }}
Constructors
- Enums do not expose constructors in C#. Under the hood this enum uses an integral underlying type (int) and the members map to integer values starting from 0 by default. {{ If you need custom numeric values, you can cast and assign explicit integers in an enum declaration; this one uses the default consecutive integers. }}
Methods
- No custom methods are declared on this enum. {{ You can use standard System.Enum/API methods such as ToString(), Enum.Parse(typeof(ActionComponent), "Press"), Enum.GetValues(typeof(ActionComponent)), or casting to/from int. There are no bitwise flags on this enum (no [Flags] attribute), so HasFlag is not meaningful here for composing multiple components. }}
Usage Example
// Example: interpreting an ActionComponent for player input handling
ActionComponent comp = ActionComponent.Positive;
switch (comp)
{
case ActionComponent.None:
// no action
break;
case ActionComponent.Press:
PerformPressAction();
break;
case ActionComponent.Positive:
Move(1.0f); // move right or up depending on axis context
break;
case ActionComponent.Negative:
Move(-1.0f); // move left or down
break;
case ActionComponent.Up:
case ActionComponent.Down:
case ActionComponent.Left:
case ActionComponent.Right:
HandleDirectionalInput(comp);
break;
}
void HandleDirectionalInput(ActionComponent c)
{
// convert directional enum to a vector or command
switch (c)
{
case ActionComponent.Up: /* apply up movement */ break;
case ActionComponent.Down: /* apply down movement */ break;
case ActionComponent.Left: /* apply left movement */ break;
case ActionComponent.Right: /* apply right movement */ break;
}
}
Additional notes:
- Use this enum when defining input mappings or when interpreting input events reported by the game's input layer.
- Because it's not a [Flags] enum, treat values as mutually exclusive atomic components.
- When serializing bindings or sending across mod APIs, convert to string or int explicitly to avoid versioning issues.