rabidus-test/Assets/KeyboardPlayerInput.cs

32 lines
911 B
C#
Raw Normal View History

2023-10-18 11:59:26 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
[CreateAssetMenu(fileName = "KeyboardInput", menuName = "PlayerInput/KeyboardInput")]
public class KeyboardPlayerInput : PlayerInputReference
{
public InputActionReference BoostInput;
public InputActionReference HorizontalInput;
private DeviceDisconnectController deviceDisconnect;
public override bool Boost()
{
Debug.Log($"{BoostInput}:{BoostInput.action}:{BoostInput.action.inProgress}");
return BoostInput.action.inProgress;
}
public override float Horizontal()
{
return -HorizontalInput.action.ReadValue<Vector2>().x;
}
public override void Init()
{
GameManager.Instance.OnStartGame();
deviceDisconnect = FindObjectOfType<DeviceDisconnectController>();
deviceDisconnect.enabled = false;
}
}