void Start()
    {
        action = GameObject.Find("Surface").GetComponent <Actions>();
        speed  = action.userSpeed;
        task   = action.task;
        dict   = task.dict;


        //to get the right shoulder position
        ik            = GameObject.Find("Assistant").GetComponent <FullBodyBipedIK>();
        R_shoulderPos = ik.solver.rightArmChain.nodes[0].transform;
        R_hand        = ik.solver.rightArmChain.nodes[2].transform;

        startTime = Time.time;

        for (int i = 0; i < task.activeNum; i++)
        {
            if (dict[i].hitTarget() == false)
            {
                for (int j = 0; j < task.activeNum; j++)
                {
                    if (Vector3.Distance(dict[i].oriObject.transform.position, dict[j].targHolder.transform.position) < 0.05f && i != j)
                    {
                        pointNum.Add(i);  //check all the cubes that are in the wrong positions
                        pointNum.Add(j);  //find a pair of cubes
                        break;
                    }
                }
            }
        }
        pointNum.Add(0);
        index = pointNum[0];
    }
    void Start()
    {
        action = GameObject.Find("Surface").GetComponent <Actions>();
        speed  = action.userSpeed;
        task   = action.task;
        dict   = task.dict;


        //to get the right shoulder position
        ik            = GameObject.Find("Assistant").GetComponent <FullBodyBipedIK>();
        R_shoulderPos = ik.solver.rightArmChain.nodes[0].transform;
        R_hand        = ik.solver.rightArmChain.nodes[2].transform;

        startTime = Time.time;


        for (int i = 0; i < task.activeNum; i++)
        {
            if (dict[task.matNum[i]].hitTarget() == false)
            {
                temp1.Add(task.matNum[i]);  //find the objects first
            }
        }

        for (int i = 0; i < temp1.Count; i++)
        {
            temp2.Add(FindtargHolder(temp1[i])); //find the target holder for each objects
        }

        temp3 = SortIndex(temp2);  //sort the target holder

        for (int i = 0; i < temp1.Count; i++)
        {
            pointNum.Add(FindObjectOnHolder(temp3[i])); //find the objects on the sorted holder
        }

        //for (int i = 0; i < task.activeNum; i++)
        //{

        //    if (dict[task.matNum[i]].hitTarget() == false)
        //    {

        //        pointNum.Add(task.matNum[i]);  //check all the cubes that are in the wrong positions

        //    }
        //}
        pointNum.Add(0);
        index = pointNum[0];

        index_holder = FindtargHolder(index);

        red   = Resources.Load <Material>("Materials/ObjectColor/red") as Material;
        white = Resources.Load <Material>("Materials/ObjectColor/white") as Material;
    }
Exemple #3
0
    public void Initialize(Task4Rules t)  // init actions(action number, task)
    {
        task = t;

        dict = t.dict;

        easePoser    = GameObject.Find("RH_ease");
        grabPoser    = GameObject.Find("RH_grab");
        releasePoser = GameObject.Find("RH_release");
        pointPoser   = GameObject.Find("RH_point");

        //AddHandPosers();
    }
    private float threshold = 0.03f; //can also use to adjust the pose will stuck somewhere or not



    void Start()
    {
        action = GameObject.Find("Surface").GetComponent <Actions>();
        speed  = action.userSpeed;
        task   = action.task;
        dict   = task.dict;


        //to get the right shoulder position
        ik            = GameObject.Find("Assistant").GetComponent <FullBodyBipedIK>();
        R_shoulderPos = ik.solver.rightArmChain.nodes[0].transform;
        R_hand        = ik.solver.rightArmChain.nodes[2].transform;

        startTime = Time.time;
    }
Exemple #5
0
    void Start()
    {
        //head = GameObject.Find("Head").transform;
        surface = GameObject.Find("Surface");


        //help = GameObject.Find("HelpPanel");
        assistant = GameObject.Find("Assistant");

        //setup lookat bones
        lookAt    = assistant.GetComponent <LookAtIK>();
        centerEye = GameObject.Find("CenterEyeAnchor").transform;


        agent_rightHand = GameObject.Find("RightHand").transform;
        user_rightHand  = GameObject.Find("RightHandAnchor").transform;
        //initialize the task
        task = surface.AddComponent <Task4Rules>();
        task.Initialize();
        action = surface.AddComponent <Actions>();
        action.Initialize(task);
        dict = task.dict;
        // InitOVRHand();

        //test correctAction

        //task.CreateNewTask(3);
        ////task.ShowDemos();
        //action.ActionTaken(3);


        ////load audio source
        LoadAudios();
        audioSource = assistant.GetComponent <AudioSource>();
        PlayAudio(clips[0]);  //start to music and say the introduction of the system

        ////start the level loop
        keywords.Add("start", () => { StartCalled(); });
        keywords.Add("repeat", () => { StartCalled(); });
        keywords.Add("demostration", () => { DemoCalled(); });
        keywords.Add("continue", () => { ContinueCalled(); });
        keywords.Add("done", () => { DoneCalled(); });

        keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray());
        keywordRecognizer.OnPhraseRecognized += KWRegOnPhraseRecognized;
        keywordRecognizer.Start();
    }
Exemple #6
0
    void Start()
    {
        action = GameObject.Find("Surface").GetComponent <Actions>();
        speed  = action.userSpeed;
        task   = action.task;
        dict   = task.dict;


        //to get the right shoulder position
        ik            = GameObject.Find("Assistant").GetComponent <FullBodyBipedIK>();
        R_shoulderPos = ik.solver.rightArmChain.nodes[0].transform;
        R_hand        = ik.solver.rightArmChain.nodes[2].transform;

        startTime = Time.time;

        index = getIndex(); //the first cube that is in the wrong position

        for (int i = 0; i < task.activeNum; i++)
        {
            dict[i].grabHolder.transform.parent = null;
        }
    }
    //Material red, m1;
    void Start()
    {
        surface = GameObject.Find("Surface");


        //help = GameObject.Find("HelpPanel");
        assistant = GameObject.Find("Assistant");

        //ik = assistant.GetComponent<FullBodyBipedIK>();
        //setup lookat bones
        lookAt    = assistant.GetComponent <LookAtIK>();
        centerEye = GameObject.Find("CenterEyeAnchor").transform;


        agent_rightHand = GameObject.Find("RightHand").transform;
        user_rightHand  = GameObject.Find("RightHandAnchor").transform;
        //initialize the task
        task = surface.AddComponent <Task4Rules>();
        task.Initialize();
        action = surface.AddComponent <Actions>();
        action.Initialize(task);
        dict = task.dict;

        //s_action = gameObject.GetComponent<SuggestAction>();
        // InitOVRHand();

        //test correctAction

        //task.CreateNewTask(3);
        ////task.ShowDemos();
        //action.ActionTaken(3);


        ////load audio source
        LoadAudios();
        audioSource = assistant.GetComponent <AudioSource>();
        PlayAudio(clips[0]);  //start to music and say the introduction of the system
        //MoveTargHolder();
        ////start the level loop
        keywords.Add("start", () => { StartCalled(); });
        //keywords.Add("repeat", () => { StartCalled(); });
        keywords.Add("demostration", () => { DemoCalled(); });
        keywords.Add("continue", () => { ContinueCalled(); });
        keywords.Add("done", () => { DoneCalled(); });

        keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray());
        keywordRecognizer.OnPhraseRecognized += KWRegOnPhraseRecognized;
        keywordRecognizer.Start();

        Debug.Log("play audio 3");

        if (File.Exists(dataPath) == false)
        {
            var outfile = new StreamWriter(dataPath, true);
            outfile.WriteLine("Create File  " + System.DateTime.Now.ToString());
            outfile.WriteLine("------  " + System.DateTime.UtcNow.ToString());
            outfile.Close();
        }
        else
        {
            var outfile = new StreamWriter(dataPath, true);
            outfile.WriteLine("*****************************PARTICIPANT***CORRECTIVE FEEDBACK*****************************" + System.DateTime.UtcNow.ToString());
            outfile.WriteLine("****************************** system 1 with picture set 1 ************************");
            //outfile.WriteLine("------  " + sce_name.name + "  ------  " + System.DateTime.UtcNow.ToString());
            outfile.Close();
        }
    }