-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ControlExtension.cs
23 lines (21 loc) · 923 Bytes
/
ControlExtension.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.OnScreen;
namespace NeKoRoSYS.InputHandling.Mobile
{
public class ControlExtension : OnScreenControl
{
[Header("Inputs")]
[InputControl(layout = "Button")]
[SerializeField] private string buttonPath = "<Keyboard>/leftShift";
[InputControl(layout = "Vector2")]
[SerializeField] private string vectorPath = "<Joystick>/stick";
protected override string controlPathInternal { get => useVector ? vectorPath : buttonPath; set { if (useVector) vectorPath = value; else buttonPath = value; } }
[Space]
[Header("Config")]
public bool useVector;
public void ProcessButton(float value) => SendValueToControl(value);
public void ProcessVector(Vector2 value) => SendValueToControl(value);
}
}