rabidus-test/Assets/VRPlayerInputReference.cs

32 lines
847 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 ="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;
}
}