예제 #1
0
 //judge helmet
 private void Helmet(object sender, KinectGestureEvent e)
 {
     if (e.name.Contains("helmet"))
     {
         GameObject.Find("CreateDiagram").GetComponent <HistogramTexture> ().setHeight(e.confidence);
     }
 }
예제 #2
0
 //judge point door
 private void pointingDoor(object sender, KinectGestureEvent e)
 {
     if (e.name.Equals("point_right"))
     {
         GameObject.Find("CreateDiagram").GetComponent <HistogramTexture> ().setHeight(e.confidence);
     }
 }
예제 #3
0
 private void wave_Lefthand(object sender, KinectGestureEvent e)
 {
     if (e.name.Equals("wavehand_Left"))
     {
         Debug.Log("wavehand Left!!!");
         Lefthand = true;
     }
     else
     {
         Lefthand = false;
     }
 }
예제 #4
0
 private void wave_Righthand(object sender, KinectGestureEvent e)
 {
     Debug.Log("wavehand Right!!!");
     if (e.name.Equals("wavehand_Right"))
     {
         Debug.Log("wavehand Right!!!");
         Righthand = true;
     }
     else
     {
         Righthand = false;
     }
 }
예제 #5
0
 //judge walking
 private void walking(object sender, KinectGestureEvent e)
 {
     if (e.name.Equals("walk"))
     {
         if (e.confidence > 0.3)
         {
             //	PlayerPrefs.SetString("BodyId",e.getOpt("BodyId"));
             //judge event done
             manager.OnGesture -= walking;
             manager.RemoveDetectors();
             GameObject.Find("Player").GetComponent <PlayerController>().StartTraning();
         }
     }
 }
예제 #6
0
    /// Handles gesture detection results arriving from the sensor for the associated body tracking Id
    private void GestureFrameArrived(object sender, VisualGestureBuilderFrameArrivedEventArgs e)
    {
        VisualGestureBuilderFrameReference frameReference = e.FrameReference;

        using (VisualGestureBuilderFrame frame = frameReference.AcquireFrame()) {
            if (frame != null)
            {
                // get the discrete gesture results which arrived with the latest frame
                IDictionary <Gesture, DiscreteGestureResult> discreteResults = frame.DiscreteGestureResults;
                if (discreteResults != null)
                {
                    foreach (Gesture gesture in _Source.Gestures)
                    {
                        if (gesture.GestureType == GestureType.Discrete)
                        {
                            DiscreteGestureResult result = null;
                            discreteResults.TryGetValue(gesture, out result);
                            //	if (gesture.Name == "recognize") {
                            //			Debug.Log ("Detected Gesture " + gesture.Name + " with Confidence " + result.Confidence);
                            //		}
                            // Fire Event
//						Debug.Log ("Detected Gesture " + gesture.Name + " with Confidence " + result.Confidence);
                            if (OnGesture != null)
                            {
                                KinectGestureEvent eventData = new KinectGestureEvent(gesture.Name, result.Confidence);
                                if (gesture.Name.Equals("recognize"))
                                {
                                    eventData.addOpt("BodyId", _Source.TrackingId.ToString());
                                }
                                OnGesture(this, eventData);
                            }
                            else
                            {
                                Debug.LogError("On Gesture is null");
                            }
                        }
                    }
                }
            }
        }
    }
예제 #7
0
    //judge helmet
    private void recognize(object sender, KinectGestureEvent e)
    {
        if (e.name.Equals("recognize"))
        {
            //GameObject.Find ("CreateDiagram").GetComponent<HistogramTexture> ().setHeight (e.confidence);
            if (e.confidence > 0.7)
            {
                //	PlayerPrefs.SetString("BodyId",e.getOpt("BodyId"));
                //judge event done
                ulong id = Convert.ToUInt64(e.getOpt("BodyId"));
                Debug.Log("detect bodyid is " + id);
                manager.confirmBody(id);
                manager.OnGesture -= recognize;
                DontDestroyOnLoad(bodymanager);
                SceneManager.LoadScene("Menu");
                manager.RemoveDetectors();

                /*manager.AddDetector ("walk");
                 * manager.OnGesture += walking;
                 * Debug.Log ("Add Walk");*/
            }
        }
    }