void initilzing() { output_path = Application.dataPath + "/sub_" + subject_number + "_md_rawdata.txt"; //group numberPersonMotion correctness map direction choice result KeyPress_Testing_path = Application.dataPath + "/sub_" + subject_number + "_md_keyPress_record.txt"; List <int> temp_list = new List <int> (); temp_list = Enumerable.Range(0, reorganized_DataSet.Length).ToList(); trial_order = ShuffleList(temp_list); // set enter direction pool task_md_enter_direction_person create_initial_direction_pool = wooden_fence.GetComponent <task_md_enter_direction_person> (); create_initial_direction_pool.create_initial_direction_pool_for_each_map(); Instantiate(FPScontroller, Vector3.zero, Quaternion.Euler(0, 0, 0)); Instantiate(wooden_fence, new Vector3(reference_coordinate_x, 0, reference_coordinate_z), Quaternion.Euler(0, 0, 0)); var aaa = Instantiate(balloon_base, new Vector3(250, -0.98f, 250), Quaternion.Euler(0, 0, 0)) as GameObject; aaa.transform.localScale = new Vector3(0.8f, 1, 0.8f); for (int i = 0; i < 34; i++) { if (i == 0) { new_coordinate_x = reference_coordinate_x; new_coordinate_z = reference_coordinate_z; Instantiate(wooden_fence, new Vector3(new_coordinate_x, 0.0f, new_coordinate_z), Quaternion.Euler(0, fence_rotation, 0)); } if (i != 0) { fence_rotation = fence_rotation + RotateAngle_for_fence; if (i == 1) { new_coordinate_x = reference_coordinate_x; new_coordinate_z = reference_coordinate_z + 4.6f; Instantiate(wooden_fence, new Vector3(reference_coordinate_x, 0.0f, new_coordinate_z), Quaternion.Euler(0, fence_rotation, 0)); } if (i > 1) { new_coordinate_x = new_coordinate_x + 4.6f * Mathf.Sin(((fence_rotation - RotateAngle_for_fence) * Mathf.PI) / 180); new_coordinate_z = new_coordinate_z + 4.6f * Mathf.Cos(((fence_rotation - RotateAngle_for_fence) * Mathf.PI) / 180); Instantiate(wooden_fence, new Vector3(new_coordinate_x, 0.0f, new_coordinate_z), Quaternion.Euler(0, fence_rotation, 0)); } } } }
void prepare_to_walk() { Destroy(canvasobject); Destroy(canvas); // get direction & subject init location which_map = reorganized_DataSet[trial_order.ElementAt(trial_ith)][1]; which_direction = reorganized_DataSet[trial_order.ElementAt(trial_ith)][2]; Number_of_person_move_head = int.Parse(reorganized_DataSet[trial_order.ElementAt(trial_ith)][4]); // output output.Add(Number_of_person_move_head + "\t"); // number of person who move head output.Add(reorganized_DataSet[trial_order.ElementAt(trial_ith)][3] + "\t"); // correctness output.Add(which_map + "\t"); output.Add(which_direction + "\t"); // order for head move & distance to center for head move headmovement_order = new List <string>(); headmovement_order.Add("head_cartoon_person_1"); headmovement_order.Add("head_cartoon_person_2"); headmovement_order.Add("head_cartoon_person_3"); headmovement_order = ShuffleList(headmovement_order); if (Number_of_person_move_head == 0) { distance_to_center_showing_motion_1 = 0; distance_to_center_showing_motion_2 = 0; distance_to_center_showing_motion_3 = 0; } if (Number_of_person_move_head == 1) { distance_to_center_showing_motion_1 = UnityEngine.Random.Range(8, 14f); distance_to_center_showing_motion_2 = 0; distance_to_center_showing_motion_3 = 0; } if (Number_of_person_move_head == 2) { distance_to_center_showing_motion_1 = UnityEngine.Random.Range(11.25f, 14f); distance_to_center_showing_motion_2 = UnityEngine.Random.Range(8, 11.25f); distance_to_center_showing_motion_3 = 0; } if (Number_of_person_move_head == 3) { distance_to_center_showing_motion_1 = UnityEngine.Random.Range(8, 10.3f); distance_to_center_showing_motion_2 = UnityEngine.Random.Range(10.3f, 12.1f); distance_to_center_showing_motion_3 = UnityEngine.Random.Range(12.1f, 14f); } // place map (person position) task_md_item_subject_person place_person_map = wooden_fence.GetComponent <task_md_item_subject_person>(); place_person_map.place_person_map(); // set subject start position task_md_enter_direction_person get_direcion_pool = wooden_fence.GetComponent <task_md_enter_direction_person> (); direction_list = get_direcion_pool.setup_enter_direction_pool(); subject_initial_position = direction_list.ElementAt(int.Parse(which_direction) - 1); // start animation task_md_item_subject_person start_idle = wooden_fence.GetComponent <task_md_item_subject_person>(); start_idle.start_idle(); // person facing to init location task_md_item_subject_person person_face_to_initial_position = wooden_fence.GetComponent <task_md_item_subject_person>(); person_face_to_initial_position.person_face_to_initial_position(); // subject move and forward FirstPersonController.m_CharacterController.transform.position = subject_initial_position; FirstPersonController.m_Camera.transform.localRotation = Quaternion.Euler(0, 0, 0); FirstPersonController.m_Camera.fieldOfView = 90; FirstPersonController.m_CharacterController.transform.forward = (subject_response_position - subject_initial_position).normalized; Invoke("runStart_init", 0); }