Unity(二十一) 关于Logitech罗技G29开发

罗技UnitySDK:

链接:https://pan.baidu.com/s/12eGEipe4kiZjWfZTFmQvSg 
提取码:sk01

说明:这份SDK可以获取罗技方向盘以及手排挡的所有数据,在Unity2018版本下测试是没问题的,只需安装罗技PC软件即可

 

 

封装工具类:

下面的摘自某大神的内容,写的很详细了,好的资源大家共享

using System;
using System.Collections;
using UnityEngine;



namespace Sakura
{
    /// 
    /// Logitech输入设备
    /// 
    public enum LogitechSteeringWheelButtonType
    {
        /// 
        /// 方向盘 X 键(按钮1)
        /// 
        x,

        /// 
        /// 方向盘 □ 键(按钮2)
        /// 
        rect,

        /// 
        /// 方向盘 ○ 键(按钮3)
        /// 
        circle,

        /// 
        /// 方向盘 △ 键(按钮4)
        /// 
        triangle,

        /// 
        /// 方向盘 右拨片 键(按钮5)
        /// 
        rightDialSlice,

        /// 
        /// 方向盘 左拨片 键(按钮6)
        /// 
        leftDialSlice,

        /// 
        /// 方向盘 R2 键(按钮7)
        /// 
        R2,

        /// 
        /// 方向盘 L2 键(按钮8)
        /// 
        L2,

        /// 
        /// 方向盘 SHARE 键(按钮9)
        /// 
        share,

        /// 
        /// 方向盘 OPTION 键(按钮10)
        /// 
        option,

        /// 
        /// 方向盘 R3 键(按钮11)
        /// 
        R3,

        /// 
        /// 方向盘 L3 键(按钮12)
        /// 
        L3,

        /// 
        /// 方向盘 + 键(按钮20)
        /// 
        plus,

        /// 
        /// 方向盘 - 键(按钮21)
        /// 
        subtract,

        /// 
        /// 方向盘 回车 键(按钮24)
        /// 
        enter,

        /// 
        ///  方向盘 logo 键(按钮25)
        /// 
        logoBtn

    }


    public enum CursorType
    {
        /// 
        ///  Up 
        ///  rec.rgdwPOV[0] = 0
        /// 
        up,

        /// 
        ///  UP-RIGHT
        ///  rec.rgdwPOV[0] = 4500
        /// 
        up_right,

        /// 
        ///  right
        ///  rec.rgdwPOV[0] = 9000
        /// 
        right,

        /// 
        ///  DOWN-RIGHT
        ///  rec.rgdwPOV[0] = 13500
        /// 
        down_right,

        /// 
        ///  down
        ///  rec.rgdwPOV[0] = 18000
        /// 
        down,

        /// 
        ///  DOWN-LEFT
        ///  rec.rgdwPOV[0] = 22500
        /// 
        down_left,

        /// 
        ///  left
        ///  rec.rgdwPOV[0] = 27000
        /// 
        left,

        /// 
        ///  UP-LEFT
        ///  rec.rgdwPOV[0] = 31500
        /// 
        up_left
    }


    public class LogitechController : MonoBehaviour
    {

        public static LogitechController Instance;

        private LogitechGSDK.DIJOYSTATE2ENGINES rec;


        /// 
        /// 方向盘 
        /// 
        public class SteeringWheel
        {
            /// 
            /// 刚点击按钮时触发一次
            /// LogitechWheelButtonType:按钮类型
            /// 
            public Action OnTriggered;
            /// 
            /// 维持点击按钮时一直触发
            /// LogitechWheelButtonType:按钮类型
            /// 
            public Action OnPressed;
            /// 
            /// 松开按钮时触发一次
            /// LogitechWheelButtonType:按钮类型
            /// 
            public Action OnReleased;

            /// 
            /// 点击按钮时触发一次,按住按钮一直触发
            /// CursorType:方向类型
            /// 
            public Action OnCursor;

            /// 
            /// 每旋转一档旋钮时触发一次
            /// bool:返回true,顺时针旋转;返回flase,逆时针旋转
            /// 
            public Action OnKnob;

            /// 
            /// 转动方向盘触发
            /// float:不触碰方向盘,值一直为0,触碰后左扭到尽:-32768,右扭到尽为32767
            /// 
            public Action OnSteeringWheel;

            
        }

        /// 
        /// 脚踏板
        /// 
        public class Pedals
        {           
            /// 
            /// 离合
            /// float:不触碰脚踏板,值一直为0,触碰后踩尽:-32768,松开为32767
            /// 
            public Action Clutch;
            /// 
            /// 刹车
            /// float:不触碰脚踏板,值一直为0,触碰后踩尽:-32768,松开为32767
            /// 
            public Action Brake;
            /// 
            /// 油门
            /// float:不触碰脚踏板,值一直为0,触碰后踩尽:-32768,松开为32767
            /// 
            public Action Throttle;
        }

        /// 
        /// 档位器
        /// 
        public class GearShifter
        {
            /// 
            /// 刚进入新档位时触发一次
            /// int:档位数(0:R档,1:1档,2:2档,以此类推)
            /// 
            public Action OnTriggered;
            /// 
            /// 维持档位时一直触发
            /// int:档位数(0:R档,1:1档,2:2档,以此类推)
            /// 
            public Action OnPressed;
            /// 
            /// 离开档位时触发一次
            /// int:档位数(0:R档,1:1档,2:2档,以此类推)
            /// 
            public Action OnReleased;

        }
        public GearShifter gearShifter;
        public Pedals pedals;
        public SteeringWheel steeringWheel;

        private void Awake()
        {
            if (Instance == null)
                Instance = this;

            gearShifter = new GearShifter();
            pedals = new Pedals();
            steeringWheel = new SteeringWheel();


            bool x = false;
           // while (x == false)
            {
                x = LogitechGSDK.LogiSteeringInitialize(false);
                Debug.Log(string.Format("LogitechSteeringInit: {0}", x));
            }
            
        }
       

        private void Update()
        {

            if (LogitechGSDK.LogiUpdate() && LogitechGSDK.LogiIsConnected(0))
            {
                #region 档位器

                //挡位 1 挡
                if (LogitechGSDK.LogiButtonTriggered(0, 12))
                {
                    if (gearShifter.OnTriggered != null) gearShifter.OnTriggered(1);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 12))
                {
                    // if (gearShifter.OnPressed != null) gearShifter.OnPressed(1);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 12))
                {
                    //if (gearShifter.OnReleased != null) gearShifter.OnReleased(1);
                }

                //挡位 2 挡
                if (LogitechGSDK.LogiButtonTriggered(0, 13))
                {
                    if (gearShifter.OnTriggered != null) gearShifter.OnTriggered(2);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 13))
                {
                    // if (gearShifter.OnPressed != null) gearShifter.OnPressed(2);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 13))
                {
                    // if (gearShifter.OnReleased != null) gearShifter.OnReleased(2);
                }

                //挡位 3 挡
                if (LogitechGSDK.LogiButtonTriggered(0, 14))
                {
                    if (gearShifter.OnTriggered != null) gearShifter.OnTriggered(3);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 14))
                {
                    //if (gearShifter.OnPressed != null) gearShifter.OnPressed(3);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 14))
                {
                    //if (gearShifter.OnReleased != null) gearShifter.OnReleased(3);
                }

                //挡位 4 挡
                if (LogitechGSDK.LogiButtonTriggered(0, 15))
                {
                    if (gearShifter.OnTriggered != null) gearShifter.OnTriggered(4);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 15))
                {
                    // if (gearShifter.OnPressed != null) gearShifter.OnPressed(4);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 15))
                {
                    //if (gearShifter.OnReleased != null) gearShifter.OnReleased(4);
                }

                //挡位 5 挡
                if (LogitechGSDK.LogiButtonTriggered(0, 16))
                {
                    if (gearShifter.OnTriggered != null) gearShifter.OnTriggered(5);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 16))
                {
                    // if (gearShifter.OnPressed != null) gearShifter.OnPressed(5);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 16))
                {
                    // if (gearShifter.OnReleased != null) gearShifter.OnReleased(5);
                }

                //挡位 6 挡
                if (LogitechGSDK.LogiButtonTriggered(0, 17))
                {
                    if (gearShifter.OnTriggered != null) gearShifter.OnTriggered(6);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 17))
                {
                    // if (gearShifter.OnPressed != null) gearShifter.OnPressed(6);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 17))
                {
                    // if (gearShifter.OnReleased != null) gearShifter.OnReleased(6);
                }

                //挡位 R 挡
                if (LogitechGSDK.LogiButtonTriggered(0, 18))
                {
                    if (gearShifter.OnTriggered != null) gearShifter.OnTriggered(0);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 18))
                {
                    //if (gearShifter.OnPressed != null) gearShifter.OnPressed(0);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 18))
                {
                    // if (gearShifter.OnReleased != null) gearShifter.OnReleased(0);
                }
                //N档            
                {
                    if (LogitechGSDK.LogiButtonReleased(0, 12)
                   || LogitechGSDK.LogiButtonReleased(0, 13)
                    || LogitechGSDK.LogiButtonReleased(0, 14)
                     || LogitechGSDK.LogiButtonReleased(0, 15)
                      || LogitechGSDK.LogiButtonReleased(0, 16)
                       || LogitechGSDK.LogiButtonReleased(0, 17)
                        || LogitechGSDK.LogiButtonReleased(0, 18))
                    {
                        if (gearShifter.OnTriggered != null) gearShifter.OnTriggered(9);
                    }
                }


                #endregion

                #region 脚踏板

                rec = LogitechGSDK.LogiGetStateUnity(0);
                             
                //离合
                if (pedals.Clutch != null) pedals.Clutch(rec.rglSlider[0]);
                //刹车
                if (pedals.Brake != null) pedals.Brake(rec.lRz);
                //油门
                if (pedals.Throttle != null) pedals.Throttle(rec.lY);
                

                #endregion

                #region 方向盘
                rec = LogitechGSDK.LogiGetStateUnity(0);
                if (steeringWheel.OnSteeringWheel != null) steeringWheel.OnSteeringWheel(rec.lX);

                //方向盘 X 键
                if (LogitechGSDK.LogiButtonTriggered(0, 0))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.x);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 0))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.x);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 0))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.x);
                }
                //方向盘 □ 键
                if (LogitechGSDK.LogiButtonTriggered(0, 1))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.rect);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 1))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.rect);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 1))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.rect);
                }
                //方向盘 ○ 键
                if (LogitechGSDK.LogiButtonTriggered(0, 2))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.circle);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 2))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.circle);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 2))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.circle);
                }
                //方向盘 △ 键
                if (LogitechGSDK.LogiButtonTriggered(0, 3))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.triangle);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 3))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.triangle);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 3))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.triangle);
                }
                //方向盘 右拨片 键
                if (LogitechGSDK.LogiButtonTriggered(0, 4))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.rightDialSlice);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 4))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.rightDialSlice);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 4))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.rightDialSlice);
                }
                //方向盘 左拨片 键
                if (LogitechGSDK.LogiButtonTriggered(0, 5))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.leftDialSlice);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 5))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.leftDialSlice);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 5))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.leftDialSlice);
                }
                //方向盘 R2 键
                if (LogitechGSDK.LogiButtonTriggered(0, 6))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.R2);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 6))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.R2);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 6))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.R2);
                }
                //方向盘 L2 键
                if (LogitechGSDK.LogiButtonTriggered(0, 7))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.L2);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 7))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.L2);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 7))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.L2);
                }
                //方向盘 SHARE 键
                if (LogitechGSDK.LogiButtonTriggered(0, 8))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.share);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 8))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.share);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 8))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.share);
                }
                //方向盘 OPTION 键
                if (LogitechGSDK.LogiButtonTriggered(0, 9))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.option);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 9))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.option);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 9))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.option);
                }
                //方向盘 R3 键
                if (LogitechGSDK.LogiButtonTriggered(0, 10))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.R3);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 10))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.R3);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 10))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.R3);
                }
                //方向盘 L3 键
                if (LogitechGSDK.LogiButtonTriggered(0, 11))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.L3);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 11))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.L3);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 11))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.L3);
                }
                //方向盘 + 键
                if (LogitechGSDK.LogiButtonTriggered(0, 19))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.plus);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 19))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.plus);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 19))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.plus);
                }
                //方向盘 - 键
                if (LogitechGSDK.LogiButtonTriggered(0, 20))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.subtract);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 20))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.subtract);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 20))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.subtract);
                }
                //方向盘 回车 键
                if (LogitechGSDK.LogiButtonTriggered(0, 23))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.enter);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 23))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.enter);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 23))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.enter);
                }
                //方向盘 logo 键
                if (LogitechGSDK.LogiButtonTriggered(0, 24))
                {
                    if (steeringWheel.OnTriggered != null) steeringWheel.OnTriggered(LogitechSteeringWheelButtonType.logoBtn);
                }
                else if (LogitechGSDK.LogiButtonIsPressed(0, 24))
                {
                    if (steeringWheel.OnPressed != null) steeringWheel.OnPressed(LogitechSteeringWheelButtonType.logoBtn);
                }
                else if (LogitechGSDK.LogiButtonReleased(0, 24))
                {
                    if (steeringWheel.OnReleased != null) steeringWheel.OnReleased(LogitechSteeringWheelButtonType.logoBtn);
                }
                //方向盘 红色滚轮右滚 键
                if (LogitechGSDK.LogiButtonTriggered(0, 21))
                {
                    if (steeringWheel.OnKnob != null) steeringWheel.OnKnob(true);
                }
                //方向盘 红色滚轮左滚 键
                if (LogitechGSDK.LogiButtonTriggered(0, 22))
                {
                    if (steeringWheel.OnKnob != null) steeringWheel.OnKnob(false);
                }

                switch (rec.rgdwPOV[0])
                {
                    case (0):      //Up
                        if (steeringWheel.OnCursor != null) steeringWheel.OnCursor(CursorType.up);
                        break;
                    case (4500):   // UP-RIGHT
                        if (steeringWheel.OnCursor != null) steeringWheel.OnCursor(CursorType.up_left);
                        break;
                    case (9000):   //right
                        if (steeringWheel.OnCursor != null) steeringWheel.OnCursor(CursorType.right);
                        break;
                    case (13500):  //DOWN-RIGHT
                        if (steeringWheel.OnCursor != null) steeringWheel.OnCursor(CursorType.down_right);
                        break;
                    case (18000):  //down
                        if (steeringWheel.OnCursor != null) steeringWheel.OnCursor(CursorType.down);
                        break;
                    case (22500):  //DOWN-LEFT
                        if (steeringWheel.OnCursor != null) steeringWheel.OnCursor(CursorType.down_left);
                        break;
                    case (27000):  //left
                        if (steeringWheel.OnCursor != null) steeringWheel.OnCursor(CursorType.left);
                        break;
                    case (31500):  //UP-LEFT
                        if (steeringWheel.OnCursor != null) steeringWheel.OnCursor(CursorType.up_left);
                        break;
                }

                #endregion

            }


        }
    

        private void OnDestroy()
        {
            
            LogitechGSDK.LogiSteeringShutdown();

            //如果这里报错,需要在LogitechGSDK里添加
            /*
              [DllImport("LogitechSteeringWheelEnginesWrapper", CharSet =CharSet.Unicode,                         
              CallingConvention = CallingConvention.Cdecl)]
              public static extern bool LogiSteeringShutdown();
            */

        }
    }


}

测试脚本:

public class LogitechDriving :MonoBehavior
{
 public Sakura.LogitechController.GearShifter gearShifter;
    public Sakura.LogitechController.Pedals pedals;
    public Sakura.LogitechController.SteeringWheel steeringWheel;


 void Start()
    {
        //接收罗技按键
        LogitechKeyEvent();

    }

 void LogitechKeyEvent()
    {
        gearShifter =  Sakura.LogitechController.Instance.gearShifter;
        pedals = Sakura.LogitechController.Instance.pedals;
        steeringWheel = Sakura.LogitechController.Instance.steeringWheel;

        if (gearShifter==null || pedals==null || steeringWheel==null) return;

        #region Events
        gearShifter.OnTriggered += (index) =>
        {
                        
            //Debug.Log(index + " OnTriggered");
        };
        //gearShifter.OnPressed += (index) =>{};
        //gearShifter.OnReleased += (index) =>{};


        pedals.Clutch += (xx) =>{ Logitech_Clutch = xx; };
        pedals.Brake += (xx) => { Logitech_Brake = xx; };
        pedals.Throttle +=(xx)=>{Logitech_Gas = xx; };


        steeringWheel.OnTriggered += (index) =>
        {
            //Debug.Log(index + " OnTriggered");
        };
        //steeringWheel.OnPressed += (index) =>{};
        //steeringWheel.OnReleased += (index) =>{};

        steeringWheel.OnCursor += (inx) =>
        {
            //Debug.Log(inx + "OnReleased "); 
        };

        steeringWheel.OnKnob += (inx) =>
        {
            //Debug.Log(inx + "OnReleased "); 
        };//旋钮

        steeringWheel.OnSteeringWheel += (inx) =>
        {
           
           
        };
        #endregion
    }
}

 

你可能感兴趣的:(Unity开发)