Ejemplo n.º 1
0
    void pureScreen()
    {
        // setting

        Destroy(canvasobject);
        Destroy(canvasobject2);

        output                    = new List <string>();
        motion_1_finished         = false;
        motion_2_finished         = false;
        motion_3_finished         = false;
        person_who_head_moved     = new List <string> ();
        person_who_head_NOT_moved = new List <string> ();
        showed_head_profile       = new List <string> ();
        task_md_item_subject_person remove_persons = wooden_fence.GetComponent <task_md_item_subject_person> ();

        remove_persons.remove_persons();

        output.Add(which_subject_group.ToString() + "\t");

        showBackgroundScreen();

        pure_duration = UnityEngine.Random.Range(3.0f, 5.0f);

        if (noITI)
        {
            Invoke("fixationScreen", 0.1f);
        }
        else
        {
            Invoke("fixationScreen", pure_duration);
        }
    }
Ejemplo n.º 2
0
    void FixedUpdate()
    {
        if (timeRecordForTotal)
        {
            Duration_for_total += Time.deltaTime;
        }
        if (timeRecordForWalking)
        {
            Duration_for_walk += Time.deltaTime;
        }
        if (timeRecordForRunning_constantSpeed)
        {
            Duration_for_run_constantSpeed += Time.deltaTime;
        }


        if (IsExploring)
        {
            timeRecordForTotal = true;

            task_md_item_subject_person person_face_to_mov_sub = wooden_fence.GetComponent <task_md_item_subject_person>();
            person_face_to_mov_sub.person_face_to_moving_subject();

            diff_betw_2Points  = subject_response_position - FirstPersonController.m_CharacterController.transform.position;
            distance_to_center = Vector3.Distance(subject_response_position, FirstPersonController.m_CharacterController.transform.position);

            if (distance_to_center > 0.25f)               // give head motion
            {
                if (distance_to_center <= distance_to_center_showing_motion_1 & !motion_1_finished)
                {
                    motion_1_finished = true;
                    task_md_item_subject_person head_movement = wooden_fence.GetComponent <task_md_item_subject_person> ();
                    person_who_head_moved.Add(headmovement_order.ElementAt(0));
                    head_movement.start_headMovement(headmovement_order.ElementAt(0));
                }
                if (distance_to_center <= distance_to_center_showing_motion_2 & !motion_2_finished)
                {
                    motion_2_finished = true;
                    task_md_item_subject_person head_movement = wooden_fence.GetComponent <task_md_item_subject_person> ();
                    person_who_head_moved.Add(headmovement_order.ElementAt(0));
                    head_movement.start_headMovement(headmovement_order.ElementAt(0));
                }
                if (distance_to_center <= distance_to_center_showing_motion_3 & !motion_3_finished)
                {
                    motion_3_finished = true;
                    task_md_item_subject_person head_movement = wooden_fence.GetComponent <task_md_item_subject_person> ();
                    person_who_head_moved.Add(headmovement_order.ElementAt(0));
                    head_movement.start_headMovement(headmovement_order.ElementAt(0));
                }

                // walking & run controller
                if (distance_to_center > point_to_run)
                {
                    timeRecordForWalking = true;
                    moving_direction     = new Vector3(diff_betw_2Points.normalized.x, -0.1f, diff_betw_2Points.normalized.z);
                    FirstPersonController.m_CharacterController.Move(moving_direction * initial_speed * Time.deltaTime);
                }
                else if (distance_to_center <= point_to_run)
                {
                    //if(!screenshot_finsh){
                    //	ScreenCapture.CaptureScreenshot("/Users/boo/Desktop/Screenshot.png");
                    //	screenshot_finsh = true;
                    //}


                    timeRecordForWalking = false;
                    //	UnityEngine.Debug.Log ("Duration_for_walk" + Duration_for_walk);
                    speedup_duration -= Time.deltaTime;
                    if (speedup_duration > 0)
                    {
                        initial_speed    = initial_speed + 0.125f;                      //+ 0.121f
                        moving_direction = new Vector3(diff_betw_2Points.normalized.x, -0.1f, diff_betw_2Points.normalized.z);
                        FirstPersonController.m_CharacterController.Move(moving_direction * initial_speed * Time.deltaTime);
                    }
                    if (speedup_duration <= 0)
                    {
                        timeRecordForRunning_constantSpeed = true;
                        moving_direction = new Vector3(diff_betw_2Points.normalized.x, -0.1f, diff_betw_2Points.normalized.z);
                        FirstPersonController.m_CharacterController.Move(moving_direction * initial_speed * Time.deltaTime);
                    }
                }
            }
            else
            {
                timeRecordForRunning_constantSpeed = false;
                timeRecordForTotal = false;
                //				UnityEngine.Debug.Log ("Duration_for_run_constantSpeed" + Duration_for_run_constantSpeed);
                UnityEngine.Debug.Log("Duration_for_total" + Duration_for_total);
                Duration_for_total             = 0;
                Duration_for_walk              = 0;
                Duration_for_run_constantSpeed = 0;

                // who did not move head? add to list
                if (headmovement_order.Count != 0)
                {
                    for (int i = 0; i < headmovement_order.Count; i++)
                    {
                        person_who_head_NOT_moved.Add(headmovement_order.ElementAt(i));
                    }
                }

                IsExploring = false;
                FirstPersonController.NO_MOVE = true;

                walking_end();
            }
        }
    }
Ejemplo n.º 3
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);
    }