//Change this Method to Send the object Color to an arduino for Example private void ChangeObjectColor(PossibleObjectColor object_color) { if (object_color == PossibleObjectColor.YELLOW) { cylinder_renderer.material.color = Color.yellow; } else { cylinder_renderer.material.color = Color.green; } return; }
// Handling the countdown (duration): // When the countdown is over, prepare the transitition to the exit method public IEnumerator CheckPositionOverTime(int object_in_position) { coroutine_running = true; for (int i = object_in_position; i > 0; i--) { text.text = "Super! Warten..." + i; // inform user about countdown yield return(new WaitForSeconds(1)); } text.text = "Fertig"; Debug.Log("You said the word: " + response); // calculate rotation of cylinder obj_rotation = Mathf.Abs(180 - cylinder.transform.rotation.eulerAngles.z) <= epsilon ? PossibleObjectColor.YELLOW : PossibleObjectColor.GREEN; // parsing response into enum type PossibleFingerStimulations pfs = (response == "daumen") ? PossibleFingerStimulations.THUMB : PossibleFingerStimulations.INDEX; // trial valid if reaction time valid, object rotation and response correct if (wordRecordedInTime && obj_rotation == InformationManager.actual_experiment.object_color && pfs == InformationManager.actual_experiment.finger_stimulation) { InformationManager.actual_experiment.SuccessfulFinished = true; } else { String errors = ""; if (!wordRecordedInTime) { errors += "Reactiontime too slow."; } if (obj_rotation != InformationManager.actual_experiment.object_color) { errors += "Wrong rotation."; } if (pfs != InformationManager.actual_experiment.finger_stimulation) { errors += "Response wrong."; } InformationManager.actual_experiment.ErrorCode = errors; } // reset: has_responded = false; wordRecordedInTime = false; response = ""; speech_receiver.Reset(); next_state = next_state_go.GetComponent <IState>(); finished = true; }
public Experiment(PossibleFingerStimulations finger, PossibleLightEffectSide effect_side, PossibleStimulationStart start, PossibleObjectColor color) { this.finger_stimulation = finger; this.light_effect_side = effect_side; this.stimulation_start = start; this.object_color = color; this.SuccessfulFinished = false; this.ReactionTime = -1; this.SpokenWord = "-"; this.HandPositions = new List <Vector3>(); this.ErrorCode = "-"; }