namespace VRTK.Examples { using UnityEngine; public class RC_Car_Controller : MonoBehaviour { public GameObject rcCar; private RC_Car rcCarScript; private void Start() { rcCarScript = rcCar.GetComponent(); GetComponent().TriggerAxisChanged += new ControllerInteractionEventHandler(DoTriggerAxisChanged); GetComponent().TouchpadAxisChanged += new ControllerInteractionEventHandler(DoTouchpadAxisChanged); GetComponent().TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased); GetComponent().TouchpadTouchEnd += new ControllerInteractionEventHandler(DoTouchpadTouchEnd); GetComponent().ButtonTwoPressed += new ControllerInteractionEventHandler(DoCarReset); } private void DoTouchpadAxisChanged(object sender, ControllerInteractionEventArgs e) { rcCarScript.SetTouchAxis(e.touchpadAxis); } private void DoTriggerAxisChanged(object sender, ControllerInteractionEventArgs e) { rcCarScript.SetTriggerAxis(e.buttonPressure); } private void DoTouchpadTouchEnd(object sender, ControllerInteractionEventArgs e) { rcCarScript.SetTouchAxis(Vector2.zero); } private void DoTriggerReleased(object sender, ControllerInteractionEventArgs e) { rcCarScript.SetTriggerAxis(0f); } private void DoCarReset(object sender, ControllerInteractionEventArgs e) { rcCarScript.ResetCar(); } } }