Esempio n. 1
0
 /// <summary>
 /// Create new instance by passing all needed data.
 /// </summary>
 /// <param name="player">Player performed gesture.</param>
 /// <param name="gesture">Recognized gesture.</param>
 /// <param name="probability">Probability of recognition.</param>
 /// <param name="length">Length of recognized gesture.</param>
 /// <param name="valid">Indicates, if gesture were recognized as valid (probability > gesture threshold).</param>
 /// <param name="forced">True if gesture was forced.</param>
 public GestureEventArgs(KinectGesturePlayer player, Gestures.IGesture gesture, double probability, int length, bool valid, bool forced = false)
 {
     SourcePlayer = player;
     Gesture = gesture;
     Probability = probability;
     IsForced = forced;
     IsValid = valid;
     Length = length;
 }
        /// <summary>
        /// Construct and initialize each KinectGesturePlayer instance and register their events.
        /// </summary>
        /// <param name="api">Instance of api using this collection.</param>
        /// <param name="playerColors">Array of 6 colors user for players visualization. If not set, uses dafaults.</param>
        public KinectGesturePlayerCollection(KinectGestureAPI api, Color[] playerColors = null)
        {
            this.api = api;
            this.kinect = api.Kinect;

            if (playerColors == null)
                playerColors = DefaultPlayerColors;

            for (int i = 0; i <= 5; i++)
            {
                players[i] = new KinectGesturePlayer(kinect, i, playerColors[i % 6]);
                players[i].SequenceReady += new SequenceReadyEventHandler(KinectGesturePlayerCollection_SequenceReady);
                players[i].GestureRecognized += new GestureRecognizedEventHandler(KinectGesturePlayerCollection_GestureRecognized);
            }

            visualElements = new List<UIElement>();
            lastUpdate = DateTime.MinValue;
        }