rabidus-test/Assets/VRPlayerInputReference.cs

32 lines
847 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
[CreateAssetMenu(fileName ="VRInput", menuName = "PlayerInput/VRInput")]
public class VRPlayerInputReference : PlayerInputReference
{
public InputActionReference LeftTrigger;
public InputActionReference RightTrigger;
private WheelActivator _wheelActivator;
private BNG.SteeringWheel _steeringWheel;
public override void Init()
{
_wheelActivator = FindObjectOfType<WheelActivator>();
_steeringWheel = FindObjectOfType<BNG.SteeringWheel>();
}
public override bool Boost()
{
return RightTrigger.action.inProgress && LeftTrigger.action.inProgress && _wheelActivator.Active;
}
public override float Horizontal()
{
return _steeringWheel.ScaleValue;
}
}