conjure-os-sdk-unity/Assets/Test-Input/TestInputBehavior.cs
William Lebel a5fa34f8b0 Add custom control scheme for new input asset
Doesn't work yet with arcade inputs
2023-05-28 16:21:51 -04:00

71 lines
2.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class TestInputBehavior : MonoBehaviour
{
private TheTestInputs inputActionAsset;
void Start()
{
inputActionAsset = new TheTestInputs();
inputActionAsset.Test.PressButtonA.performed += PressButtonA;
inputActionAsset.Test.PressButtonB.performed += PressButtonB;
inputActionAsset.Test.PressButtonC.performed += PressButtonC;
inputActionAsset.Test.PressButton1.performed += PressButton1;
inputActionAsset.Test.PressButton2.performed += PressButton2;
inputActionAsset.Test.PressButton3.performed += PressButton3;
inputActionAsset.Test.PressButtonStart.performed += PressButtonStart;
inputActionAsset.Test.PressButtonPower.performed += PressButtonPower;
inputActionAsset.Test.Move.performed += UseJoystick;
}
void PressButtonA(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button A");
}
void PressButtonB(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button B");
}
void PressButtonC(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button C");
}
void PressButton1(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button 1");
}
void PressButton2(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button 2");
}
void PressButton3(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button 3");
}
void PressButtonStart(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button start");
}
void PressButtonPower(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button power");
}
void UseJoystick(InputAction.CallbackContext callbackContext)
{
Vector2 direction = callbackContext.ReadValue<Vector2>();
Debug.Log($"Joystick: {direction}");
}
}