Game.Input.Vector2Component
Assembly: Assembly-CSharp (in-game code)
Namespace: Game.Input
Type: enum
Base: System.Enum
Summary: Represents the four directional components of a 2D vector used by the input system. Each enum value maps to an integer, starting at 4 for Down and incrementing for subsequent directions. This enum is useful when you need to refer to a specific vector component (Up/Down/Left/Right) in input handling, mapping, or serialization within the game's input code.
Fields
-
Down = 4
Represents the downward component. Explicitly assigned the integer value 4. Useful when decoding numeric input identifiers or preserving a stable external mapping. -
Up = 5
Represents the upward component. Follows from the explicit value of Down and is assigned 5. -
Left = 6
Represents the leftward component. Assigned 6. -
Right = 7
Represents the rightward component. Assigned 7.
Properties
- None.
This enum exposes no properties; it provides named constant values only.
Constructors
- None explicitly defined.
As with all enums, the underlying value-to-name mapping is provided by the compiler; there are no user-defined constructors.
Methods
- None.
No instance or static methods are declared on this enum.
Usage Example
using Game.Input;
void HandleDirection(Vector2Component comp)
{
switch (comp)
{
case Vector2Component.Up:
// move or process up
break;
case Vector2Component.Down:
// move or process down
break;
case Vector2Component.Left:
// move or process left
break;
case Vector2Component.Right:
// move or process right
break;
}
}
// Casting from int (e.g., deserialized input id)
int rawId = 6;
if (Enum.IsDefined(typeof(Vector2Component), rawId))
{
Vector2Component c = (Vector2Component)rawId; // yields Vector2Component.Left
HandleDirection(c);
}