Esempio n. 1
0
        void KinectMInputInitialize(KinectActiveHandStadus kinectActiveHandStadus)
        {
            InputHands = new Dictionary <int, MInputHand>();
            switch (kinectActiveHandStadus)
            {
            case KinectActiveHandStadus.None:
                throw new Exception("单双手状态未选择");

            case KinectActiveHandStadus.One:
                //初始化手的种类
                var handUI    = MHandUIManager.CreateHandUI(transform, rightHandSprite, handSize);
                var inputHand = new MInputHand(0, handUI, OperatePlatform.Kinect);
                InputHands.Add(0, inputHand);

                isPlaying = true;

                //注册操作者相关事件
                var operate = MOperateManager.AddOperateHand(inputHand, this);
                //注册方法
                operate.OnGrab    = OnRightGrabObject;
                operate.OnSetGrab = SetGrabObject;
                operate.OnEnable();

                break;

            case KinectActiveHandStadus.Two:
                //初始化手的种类
                var rightHandUI    = MHandUIManager.CreateHandUI(transform, rightHandSprite, handSize);
                var rightInputHand = new MInputHand(0, rightHandUI, OperatePlatform.Kinect);
                InputHands.Add(0, rightInputHand);

                var leftHandUI    = MHandUIManager.CreateHandUI(transform, leftHandSprite, handSize);
                var leftInputHand = new MInputHand(1, leftHandUI, OperatePlatform.Kinect);
                InputHands.Add(1, leftInputHand);

                isPlaying = true;

                //注册操作者相关事件
                var rightOperate = MOperateManager.AddOperateHand(rightInputHand, this);
                //注册方法
                rightOperate.OnGrab    = OnRightGrabObject;
                rightOperate.OnSetGrab = SetGrabObject;
                rightOperate.OnEnable();

                //注册操作者相关事件
                var leftOperate = MOperateManager.AddOperateHand(leftInputHand, this);
                //注册方法
                leftOperate.OnGrab    = OnLeftGrabObject;
                leftOperate.OnSetGrab = SetGrabObject;
                leftOperate.OnEnable();
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
 public void StartMultipleHand()
 {
     kinectHandStartStatus = KinectActiveHandStadus.Two;
     KinectConfig.SetHandStartStatus(kinectHandStartStatus); // 设置单双手操作
 }
Esempio n. 3
0
 public void StartOnlyHand()
 {
     kinectHandStartStatus = KinectActiveHandStadus.One;
     KinectConfig.SetHandStartStatus(kinectHandStartStatus); // 设置单双手操作
 }