Пример #1
0
    void prepare_to_walk()
    {
        Destroy(canvasobject);
        Destroy(canvas);

        // get direction & subject init location
        if (exp_stage == 1)
        {
            which_map                  = practice_formal_stage1_DataSet[trial_ith_formal_exp_stage1][0];
            which_direction            = practice_formal_stage1_DataSet[trial_ith_formal_exp_stage1][1];
            Number_of_person_move_head = int.Parse(practice_formal_stage1_DataSet[trial_ith_formal_exp_stage1][3]);
        }
        if (exp_stage == 2)
        {
            which_map                  = practice_formal_stage2_DataSet[trial_ith_formal_exp_stage2][0];
            which_direction            = practice_formal_stage2_DataSet[trial_ith_formal_exp_stage2][1];
            which_person               = practice_formal_stage2_DataSet[trial_ith_formal_exp_stage2][2];
            Number_of_person_move_head = int.Parse(practice_formal_stage2_DataSet[trial_ith_formal_exp_stage2][4]);
        }
        if (exp_stage == 3)
        {
            which_map       = practice_formal_stage3_DataSet[trial_ith_formal_exp_stage3][0];
            which_direction = practice_formal_stage3_DataSet[trial_ith_formal_exp_stage3][1];
            which_person    = practice_formal_stage3_DataSet[trial_ith_formal_exp_stage3][2];

            Number_of_person_move_head = int.Parse(practice_formal_stage3_DataSet[trial_ith_formal_exp_stage3][4]);
        }



        // 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)
        practice_fmri_item_subject_person place_person_map = wooden_fence.GetComponent <practice_fmri_item_subject_person>();

        place_person_map.place_person_map();

        // set subject start position
        practice_fmri_enter_direction_person get_direcion_pool = wooden_fence.GetComponent <practice_fmri_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
        practice_fmri_item_subject_person start_idle = wooden_fence.GetComponent <practice_fmri_item_subject_person>();

        start_idle.start_idle();
        // person facing to subject
        practice_fmri_item_subject_person person_face_to_initial_position = wooden_fence.GetComponent <practice_fmri_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;

        if ((isIn_formal_exp_stage1 & trial_ith_formal_exp_stage1 < 2) |
            (isIn_formal_exp_stage2 & trial_ith_formal_exp_stage2 < 2))
        {
            isPausing_inst_walkingStart = true;
        }
        else
        {
            Invoke("runStart_init", 0);
        }
    }