27 lines
731 B
C#
27 lines
731 B
C#
using UnityEngine.InputSystem;
|
|
|
|
|
|
public class InputPreset20 : InputPreset
|
|
{
|
|
public override float GetValueInput(InputDevice device, TypeValueJoystick direction)
|
|
{
|
|
byte[] bytes = (byte[])device.ReadValueAsObject();
|
|
|
|
switch (direction)
|
|
{
|
|
case TypeValueJoystick.LeftX:
|
|
return bytes[10] + (bytes[11] * byte.MaxValue);
|
|
case TypeValueJoystick.RightX:
|
|
return bytes[4] + (bytes[5] * byte.MaxValue);
|
|
case TypeValueJoystick.LeftY:
|
|
return bytes[8] + (bytes[9] * byte.MaxValue);
|
|
case TypeValueJoystick.RightY:
|
|
return bytes[6] + (bytes[7] * byte.MaxValue);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
}
|