Exemplo n.º 1
0
    /*  Function to be called by an outside script wanting to being the calibration process.
     *   Requires an exercise parameter to know which calibration sequence to start.
     */
    public void beginCalibration(ExerciseLibrary.Exercise exerciseToCalibrate)
    {
        resetCardboardModelPositions();
        calibrationCanvas.enabled = true;
        userCalibrating           = true;
        calibrationExercise       = exerciseToCalibrate;
        calibrationStep           = 0;

        advanceToStep(calibrationExercise, calibrationStep);
    }
Exemplo n.º 2
0
 public void beginWorkout(ExerciseLibrary.Exercise exerciseToCalibrate)
 {
     previousPosition     = 3;
     instructionText.text = "Press button on headset to STOP";
     workoutInProgress    = true;
     workoutDone          = false;
     firstWorkoutFrame    = true;
     setsSoFar            = 0;
     repsSoFar            = 0;
     repstot          = 0;
     calory           = 0;
     position1Next    = true;
     selectedExercise = exerciseToCalibrate;
 }
Exemplo n.º 3
0
 /*  This is the main driving function of the calibration walkthrough.
  *  This function determines the UI elements and behavior of each step in
  *  the calibration depending on the chosen exercise.
  */
 private void advanceToStep(ExerciseLibrary.Exercise exerciseToCalibrate, int step)
 {
     if (calibrationExercise == ExerciseLibrary.Exercise.SitUp)
     {
         if (step == 0)
         {
             setCanvasText("Press button on headset\nto begin sit-up calibration");
         }
         else if (step == 1)
         {
             setCanvasText("Get in position 1 of a sit-up,\nthen press button on headset");
             setCanvasImage(situpPosition1Image);
         }
         else if (step == 2)
         {
             readPositionAngles(1);
             setCanvasText("Get in position 2 of a sit-up,\nthen press button on headset");
             setCanvasImage(situpPosition2Image);
         }
         else if (step == 3)
         {
             readPositionAngles(2);
             setCanvasText("Calibrated successfully!\nPress button on headset to begin workout");
             setCanvasImage(null);
         }
         else
         {
             endCalibration();
         }
     }
     else if (calibrationExercise == ExerciseLibrary.Exercise.TwistCrunch)
     {
         if (step == 0)
         {
             setCanvasText("Press button on headset\nto begin twist-crunch calibration");
         }
         else if (step == 1)
         {
             setCanvasText("Get in position 1 of a twist-crunch,\nthen press button on headset");
             setCanvasImage(twistcrunchPosition1Image);
         }
         else if (step == 2)
         {
             readPositionAngles(1);
             setCanvasText("Get in position 2 of a twist-crunch,\nthen press button on headset");
             setCanvasImage(twistcrunchPosition2Image);
         }
         else if (step == 3)
         {
             readPositionAngles(2);
             setCanvasText("Get in position 3 of a twist-crunch,\nthen press button on headset");
             setCanvasImage(twistcrunchPosition3Image);
         }
         else if (step == 4)
         {
             readPositionAngles(3);
             setCanvasText("Calibrated successfully!\nPress button on headset to begin workout");
             setCanvasImage(null);
         }
         else
         {
             endCalibration();
         }
     }
     else if (calibrationExercise == ExerciseLibrary.Exercise.TwistLunge)
     {
         if (step == 0)
         {
             setCanvasText("Press button on headset\nto begin twist-lunge calibration");
         }
         else if (step == 1)
         {
             setCanvasText("Get in position 1 of a twist-lunge,\nthen press button on headset");
             setCanvasImage(twistlungePosition1Image);
         }
         else if (step == 2)
         {
             readPositionAngles(1);
             setCanvasText("Get in position 2 of a twist-lunge,\nthen press button on headset");
             setCanvasImage(twistlungePosition2Image);
         }
         else if (step == 3)
         {
             readPositionAngles(2);
             setCanvasText("Get in position 3 of a twist-lunge,\nthen press button on headset");
             setCanvasImage(twistlungePosition3Image);
         }
         else if (step == 4)
         {
             readPositionAngles(3);
             setCanvasText("Calibrated successfully!\nPress button on headset to begin workout");
             setCanvasImage(null);
         }
         else
         {
             endCalibration();
         }
     }
     else
     {
         setCanvasText("Calibration not supported for this exercise");
     }
 }