using UnityEngine; using UnityEngine.InputSystem; namespace ArcadeVP { public class InputManager_ArcadeVP : MonoBehaviour { public ArcadeVehicleController arcadeVehicleController; [HideInInspector] public float steering; [HideInInspector] public float acceleration; [HideInInspector] public float handbrake; [HideInInspector] public float brake; private PlayerInput _playerInput; private InputAction _steerAction; private InputAction _accelAction; private InputAction _handbrakeAction; private InputAction _brakeAction; private void Awake() { _playerInput = GetComponent(); if (_playerInput == null) { Debug.LogError("PlayerInput component not found on the GameObject."); return; } _steerAction = _playerInput.actions["Steer"]; _accelAction = _playerInput.actions["Accelerate"]; _handbrakeAction = _playerInput.actions["HandBrake"]; _brakeAction = _playerInput.actions["Brake"]; } private void Update() { steering = _steerAction?.ReadValue() ?? 0f; acceleration = _accelAction?.ReadValue() ?? 0f; handbrake = _handbrakeAction?.ReadValue() ?? 0f; brake = _brakeAction?.ReadValue() ?? 0f; arcadeVehicleController.ProvideInputs(steering, acceleration, handbrake, brake); } } }