Exemplo n.º 1
0
        // ジェスチャーを検出した
        void gesture_GestureRecognized(object sender, GestureRecognizedEventArgs e)
        {
            gestureStatus = GestureStatus.Recognized;

            // 手のトラッキングを開始する
            hands.StartTracking(e.EndPosition);
        }
 void gestures_GestureRecognized(object Sender, GestureRecognizedEventArgs e)
 {
     if (handId == -1)
     {
         this.hands.StartTracking(e.IdentifiedPosition);
     }
 }
Exemplo n.º 3
0
    void gestures_GestureRecognized(object Sender, GestureRecognizedEventArgs e)
    {
        // wave stealing
        if (handId != -1 && e.Gesture == "Wave" && StealOnWave)
        {
            EndSession();
        }

        if (handId == -1)
        {
            if (e.Gesture == "RaiseHand" && ExperimentalGestureless)
            {
                int user = WhichUserDoesThisPointBelongTo(e.IdentifiedPosition);
                if (0 == user)
                {
                    // false positive if no one raised their hand, miss detect if user
                    // isn't on usermap (at this during this frame at the gesture position)
                    return;
                }

                // TODO: make sure point is in a good position relative to the CoM of the user
                // TODO: possibly take top user point into account?
                //Vector3 CoM = Point3DToVector3(userGenerator.GetCoM(user));
                //Vector3 gesturePoint = Point3DToVector3(e.IdentifiedPosition);
                this.hands.StartTracking(e.IdentifiedPosition);
            }

            if ((e.Gesture == "Wave" && DetectWave) ||
                (e.Gesture == "Click" && DetectPush))
            {
                this.hands.StartTracking(e.IdentifiedPosition);
            }
        }
    }
Exemplo n.º 4
0
        /// <summary>
        /// Handles state transition
        /// </summary>
        /// <param name="args">The gesture details</param>
        public void RaiseGestureRecognizedEvent(GestureRecognizedEventArgs args)
        {
            this.PerformTransition(args.Event);

            if (this.GestureRecognized != null)
            {
                this.GestureRecognized(this, args);
            }
        }
Exemplo n.º 5
0
 //START-HAND Tracking
 void gesture_GestureRecognized(object sender, GestureRecognizedEventArgs e)
 {
     Debug.Log("Algo --> " + e.Gesture);
     if (e.Gesture == "Wave")
     {
         this.hands.StartTracking(e.EndPosition);
         Debug.Log("Tracking ");
     }
 }
Exemplo n.º 6
0
        /*
         * public void OnGestureRecognized(object sender, GestureRecognizedEventArgs args)
         * {
         *  switch (args.typeGeste)
         *  {
         *      case Gesture.GestureType.Selection:
         *          typeCurrentElement = sélections[args.nomGeste];
         *          ElementPret(typeCurrentElement);
         *          break;
         *      case Gesture.GestureType.Action:
         *          if (typeCurrentElement == ElemType.Unknown) break;
         *          actions[args.nomGeste](typeCurrentElement, this);
         *          break;
         *  }
         * }
         */


        // ! : Seuls les gestes du joueur 1 sont reconnus, le code est à changer. On peut utiliser les boutons en attendant pour simuler les gestes du joueur 2.
        public void OnGestureRecognized(object sender, GestureRecognizedEventArgs args)
        {
            switch (args.typeGeste)
            {
            case Gesture.GestureType.Selection:
                joueur1.ElementPret(sélections[args.nomGeste], this);
                break;

            case Gesture.GestureType.Action:
                if (joueur1.typeCurrentElement == ElemType.Unknown)
                {
                    break;
                }
                actions[args.nomGeste](joueur1, joueur2, this);
                break;
            }
        }
Exemplo n.º 7
0
        public void TestRaiseGestureRecognizedEvent()
        {
            // arrange
            var args = new GestureRecognizedEventArgs(null, FSMEventId.GoIdle);
            var fsm  = new Mock <GesturesFSM <TrackingContext> >(new Mock <TrackingContext>().Object)
            {
                CallBase = true
            };
            bool eventRaised = false;

            fsm.Object.GestureRecognized += new GestureRecognizedEventHandler((obj, a) => eventRaised = true);
            fsm.Setup(x => x.PerformTransition(args.Event));

            // act
            fsm.Object.RaiseGestureRecognizedEvent(args);

            // assert
            fsm.VerifyAll(); // state transition called
            Assert.IsTrue(eventRaised, "gesture event raised");
        }
Exemplo n.º 8
0
        void gestureGenerator_GestureRecognized(object sender, GestureRecognizedEventArgs e)
        {
            NiteKinectHandGestureEventData eventdata;

            switch (e.Gesture.ToLower())
            {
            case "wave":
                handsGenerator.StartTracking(e.IdentifiedPosition);
                break;

            case "click":
                eventdata = new NiteKinectHandGestureEventData(new NiteKinectHandGestureData(0, NiteKinectHandState.GestureClick, this.depth.ConvertRealWorldToProjective(e.EndPosition)));
                if (DataReceived != null)
                {
                    DataReceived(this, new DataReceivedEventHandler()
                    {
                        PluginData = eventdata
                    });
                }
                break;

            case "raisehand":
                eventdata = new NiteKinectHandGestureEventData(new NiteKinectHandGestureData(0, NiteKinectHandState.GestureRaiseHand, this.depth.ConvertRealWorldToProjective(e.EndPosition)));
                if (DataReceived != null)
                {
                    DataReceived(this, new DataReceivedEventHandler()
                    {
                        PluginData = eventdata
                    });
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 9
0
 private void fsm_GestureRecognized(object sender, GestureRecognizedEventArgs args)
 {
     AddMessage(string.Format("Gesture {0} recognized, distance {1}", args.Gesture.Id, args.Gesture.MinDistance.ToString("F2")));
 }
Exemplo n.º 10
0
 // ジェスチャーを検出した
 void gesture_GestureRecognized(object sender, GestureRecognizedEventArgs e)
 {
     gestureStatus = GestureStatus.Recognized;
 }
Exemplo n.º 11
0
        void FGesture_GestureRecognized(object sender, GestureRecognizedEventArgs e)
        {
            Vector3D Vector = new Vector3D(e.EndPosition.X, e.EndPosition.Y, e.EndPosition.Z);

            FGestureRecognized.Add(Vector, e.Gesture);
        }