/// <summary> /// /// Always starts the rep. We ignore the skeletonStamp in this case /// </summary> /// <returns></returns> public bool isRepStarted(SkeletonStamp skeletonStamp) { startTime = DateTime.Now; /// add 30 seconds TimeSpan time = new TimeSpan(0, 0, 0, 3); endTime = startTime.Add(time); return true; }
/// <summary> /// /// Always starts the rep. We ignore the skeletonStamp in this case /// </summary> /// <returns></returns> public bool isRepStarted(SkeletonStamp skeletonStamp) { startTime = DateTime.Now; /// add 30 seconds TimeSpan time = new TimeSpan(0, 0, 0, 3); endTime = startTime.Add(time); return(true); }
/// <summary> /// /// Ends the rep after the current time is greater than the end time created upon the start of the rep. /// </summary> /// <returns></returns> public bool isRepComplete(SkeletonStamp skeletonStamp) { return DateTime.Now > endTime; }
public double[] checkForm(SkeletonStamp skeletonStamp) { return new double[20]; }
public double[] checkForm(SkeletonStamp skeletonStamp) { return(new double[20]); }
/// <summary> /// /// Ends the rep after the current time is greater than the end time created upon the start of the rep. /// </summary> /// <returns></returns> public bool isRepComplete(SkeletonStamp skeletonStamp) { return(DateTime.Now > endTime); }
public override void Update(GameTime gameTime) { // the stamp being processed SkeletonStamp skeletonStamp = _skeletonPool.GetOldestActiveSkeleton(); double[] percentBad = new double[20]; // determine whether a rep has been started based on Exercise Start Criteria. if (skeletonStamp != null && skeletonStamp.GetTrackedSkeleton() != null) { if (!ExerciseStarted) { /* make sure we're in the correct starting position */ if (repetition.isRepStarted(skeletonStamp)) { if (!_countdownStarted) { /* its the finallllllll countdowwwwwwwn http://www.youtube.com/watch?v=9jK-NcRmVcw */ _countdownStarted = true; Counter = 3; } else { _currentTime += (float)gameTime.ElapsedGameTime.TotalSeconds; //Time passed since last Update() if (_currentTime >= _countDuration) { Counter--; _currentTime -= _countDuration; // clearout the time } if (Counter <= _limit) { ExerciseStarted = RepetitionStarted = true; } } } else { /* reset the counter */ _countdownStarted = false; Counter = -1; // initialize the checkpoint to the 0 based checkpoint. repetition.Checkpoint = _exercise.Checkpoints.Length; } } else if (!RepetitionStarted) { // initialize the checkpoint to the 0 based checkpoint. repetition.Checkpoint = _exercise.Checkpoints.Length; RepetitionStarted = repetition.isRepStarted(skeletonStamp); } else { // this needs to be here so we do not count a rep twice by accident before the next draw occurs. // A couple updates could occur before the next draw. if (!RepetitionComplete) { // see if the rep has been completed if (RepetitionComplete = repetition.isRepComplete(skeletonStamp)) { // increment reps completed and reset the flags Repetitions++; RepetitionComplete = RepetitionStarted = false; // remove all the skeletons before this skeleton _skeletonPool.FinishedWithSkeleton(skeletonStamp.TimeStamp); } } } // if the rep has been started we need to check the form of the repetition // just a stub of what needs to be done... we'll need to determine how a FormResponse should look. percentBad = repetition.checkForm(skeletonStamp); skeletonStamp.PercentBad = percentBad; } // remove the skeleton stamp so it can move on if (skeletonStamp != null) { _skeletonPool.FinishedWithSkeleton(skeletonStamp.TimeStamp); } base.Update(gameTime); }