// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { edc.SetLogging(EyeDataCollect.LoggingStatus.Active); } if (Input.GetKeyDown(KeyCode.LeftAlt)) { edc.SetLogging(EyeDataCollect.LoggingStatus.Pause); // pause data logging edc.Publish(); // publish to file edc.SetLogging(EyeDataCollect.LoggingStatus.Clear); // clear data log } }
void Start() { // seed the random number generator Random.InitState(randomSeed); // save all primitives primitives = new Dictionary <string, GameObject>(); foreach (Transform t in GameObject.Find("GeometricPrimitives").transform) { primitives.Add(t.name, t.gameObject); } //Add all the available holders to the manager vholders = new List <GameObject>(); hholders = new List <GameObject>(); foreach (Transform child in transform) { if (child.name.Contains("VerticalHolder")) { vholders.Add(child.gameObject); } else if (child.name.Contains("HorizontalHolder")) { hholders.Add(child.gameObject); } } // find button button = GetComponentInChildren <ButtonPress>(); // find data logger logger = FindObjectOfType <DataLogger>(); logger.SetLogging(DataLogger.LoggingStatus.Clear); edc = FindObjectOfType <EyeDataCollect>(); edc.SetLogging(EyeDataCollect.LoggingStatus.Clear); // clear PHAM ClearPHAM(); }
void Update() { switch (currentStage) { case PHAMStage.Inactive: taskSuccess = false; // reset task success value timeElapsed = 0.0f; // reset timer button.gameObject.GetComponent <Renderer>().material.color = Color.red; // indicate that button needs to be pressed if (button.GetButtonStatus()) { ColorHolder(); // generate a new task button.SetButtonStatus(false); // reset button status button.gameObject.GetComponent <Renderer>().material.color = Color.green; // reset button color currentStage = PHAMStage.Active; // set the stage to active logger.SetLogging(DataLogger.LoggingStatus.Active); // activate data logging edc.SetLogging(EyeDataCollect.LoggingStatus.Active); } break; case PHAMStage.Active: timeElapsed += Time.deltaTime; // update timer // get dropped / success status bool dropped = false; bool success = false; dropped = primitives["Cylinder"].GetComponent <DroppedObjectLogic>().GetDroppedStatus(); success = primitives["Cylinder"].GetComponent <SuccessTaskLogic>().GetSuccessStatus(); if (success || dropped) { primitives["Cylinder"].GetComponent <GraspingObjectLogic>().ClearFixedJoints(); } if (dropped || (timeElapsed > taskTimeout)) { // object was dropped, task failed, load next task if (dropped) { Debug.Log("Object was dropped! Task failed!"); } else { Debug.Log("Task timeout reached! Task failed!"); } taskSuccess = false; // set task success to false ClearPHAM(); // reset PHAM logger.SetLogging(DataLogger.LoggingStatus.Pause); // pause data logging logger.Publish(); // publish to file logger.SetLogging(DataLogger.LoggingStatus.Clear); // clear data log edc.SetLogging(EyeDataCollect.LoggingStatus.Pause); // pause data logging edc.Publish(); // publish to file edc.SetLogging(EyeDataCollect.LoggingStatus.Clear); // clear data log button.SetButtonStatus(false); // make sure button is not pressed currentStage = PHAMStage.Inactive; // set PHAM stage to inactive } else if (success && button.GetButtonStatus()) { // object in the target holder, task succeeded button.gameObject.GetComponent <Renderer>().material.color = Color.red; // indicate that button needs to be pressed // button press signals the end of the task Debug.Log("Logging successful task!"); // clear PHAM taskSuccess = true; // set task success to true ClearPHAM(); // reset PHAM logger.SetLogging(DataLogger.LoggingStatus.Pause); // pause data logging logger.Publish(); // publish to file logger.SetLogging(DataLogger.LoggingStatus.Clear); // clear data log edc.SetLogging(EyeDataCollect.LoggingStatus.Pause); // pause data logging edc.Publish(); // publish to file edc.SetLogging(EyeDataCollect.LoggingStatus.Clear); // clear data log button.SetButtonStatus(false); // make sure button is not pressed button.gameObject.GetComponent <Renderer>().material.color = Color.grey; // reset button color currentStage = PHAMStage.Inactive; // set PHAM stage to inactive } break; } }
// Start is called before the first frame update void Start() { edc = FindObjectOfType <EyeDataCollect>(); edc.SetLogging(EyeDataCollect.LoggingStatus.Clear); }