/// <summary> /// Controls animation of TrainingCube /// </summary> void Update() { //Neutral action = dont move //Right if (action == ACTION_RIGHT) { if (transform.localPosition.x < startPos + offset) { transform.Translate(speed * Time.deltaTime * 10, 0, 0); } if (UI.rightTrial && transform.position.x > startPos + 5) { LoggerCSV.GetInstance().AddEvent(LoggerCSV.EVENT_TRAINING_TRIAL_PASS_R); UI.UpdateUI("done right"); } } //Left else if (action == ACTION_LEFT) { if (transform.localPosition.x > startPos - offset) { transform.Translate(-speed * Time.deltaTime * 10, 0, 0); } if (UI.leftTrial && transform.position.x < startPos - 5) { LoggerCSV.GetInstance().AddEvent(LoggerCSV.EVENT_TRAINING_TRIAL_PASS_L); UI.UpdateUI("done left"); } } }
/// <summary> /// Clear mental command accepted by Accept_Clear_Button, /// Clears all data if neutral is cleared /// </summary> /// <param name="type">Command to be trained ("Neutral","Left","Right")</param> public void ClearTraining() { LoggerCSV logger = LoggerCSV.GetInstance(); string statusText = "Neutral"; EdkDll.IEE_MentalCommandAction_t action = EdkDll.IEE_MentalCommandAction_t.MC_NEUTRAL; switch (trainType) { case "clear left": statusText = "Left"; action = EdkDll.IEE_MentalCommandAction_t.MC_LEFT; trainType = "clear left"; logger.AddEvent(LoggerCSV.EVENT_TRAINING_CLEAR_L); break; case "clear right": statusText = "Right"; action = EdkDll.IEE_MentalCommandAction_t.MC_RIGHT; trainType = "clear right"; logger.AddEvent(LoggerCSV.EVENT_TRAINING_CLEAR_R); break; default: logger.AddEvent(LoggerCSV.EVENT_TRAINING_CLEAR_N); UI.UpdateStatusText("Current Aciton: None"); trainType = "clear neutral"; Debug.Log(action); EraseAction(action); //Clear left and right if enabled //Left if (EmoMentalCommand.MentalCommandActionsEnabled[5]) { Debug.Log("left active - clear"); EraseAction(EdkDll.IEE_MentalCommandAction_t.MC_LEFT); } //Right if (EmoMentalCommand.MentalCommandActionsEnabled[6]) { Debug.Log("right active - clear"); EraseAction(EdkDll.IEE_MentalCommandAction_t.MC_LEFT); } DeactivateRL(); //Update UI and Training cube UI.UpdateStatusText("Cleared " + statusText + " Training Data"); UI.UpdateUI(trainType); cube.SetAciton(cube.ACTION_RESET); return; } EraseAction(action); //Deactivate cleared action EmoMentalCommand.EnableMentalCommandAction(action, false); EmoMentalCommand.EnableMentalCommandActionsList(); //Update UI and Training cube UI.UpdateUI(trainType); UI.ActivateButtons(true); cube.SetAciton(cube.ACTION_RESET); UI.UpdateStatusText("Cleared " + statusText + " Training Data"); }