//Increment through calibration positions void UpdateCalibration(GloveDataProcessor gloveDataProcessor) { if (Input.touchCount > 0 && lastTouch == 0) { gloveDataProcessor.captureDataAgainstTrainingPosition(); } lastTouch = Input.touchCount; }
//Update UI based on touch feedback void ManageTouchEvent(GloveDataProcessor gloveDataProcessor) { if (gloveDataProcessor.IsCalibrating) { UpdateCalibration(gloveDataProcessor); } else { RotateCharacter(); } }
//Get Calibration or Calibrated positions for avatar double[] GetPositionData(GloveDataProcessor gloveDataProcessor) { if (gloveDataProcessor.IsCalibrating) //IF IS CALIBRATION GET TRAINING POSITIONS WHICH ARE DECLARED IN CALIBRATIONALGORITHM { return(gloveDataProcessor.getCurrentTrainingPosition()); } else //Running { return(gloveDataProcessor.getCalibratedData()); //ONCE CALIBRATION IS DONE GET REALDATA } }
// Update is called once per frame void Update() { double[] Position = null; if (mainController != null) { gloveDataProcessor = mainController.GetComponent <GloveConnectionManager>().getGloveDataProcessor(); if (btnStartCalibration != null && !eventAdded) { btnStartCalibration.onClick.AddListener(startCalibration); eventAdded = true; } } if (gloveDataProcessor != null) { ManageTouchEvent(gloveDataProcessor); Position = GetPositionData(gloveDataProcessor); if (Position != null && Position.Length > 0) { UpdateAvatar(Position); } } }