예제 #1
0
    /// <summary>
    /// set action for the posAction Button = actionID
    /// </summary>
    /// <param name="possAction"></param>
    /// <param name="actionID"></param>
    void ChooseAction(int posAction, int actionID)
    {
        // set str_ActionChoose
        if (actionID != 0)
        {
            str_ActionChoose[posAction] = array_CogActionList[actionID];
        }
        else
        {
            str_ActionChoose[posAction] = "Choose Action";
        }


        // recheck enable, disable Actions
        for (int l = 1; l < 14; l++)
        {
            //EnableMentalCommandAction
            EmoMentalCommand.EnableMentalCommandAction(EmoMentalCommand.MentalCommandActionList[l], false);
        }

        for (int i = 1; i < 14; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (str_ActionChoose[j] == array_CogActionList[i])
                {
                    EmoMentalCommand.EnableMentalCommandAction(EmoMentalCommand.MentalCommandActionList[i], true);
                }
            }
        }

        EmoMentalCommand.EnableMentalCommandActionsList();
    }
 private void OnDeactiveClick(int ActionID)
 {
     EmoMentalCommand.EnableMentalCommandAction(EmoMentalCommand.MentalCommandActionList[ActionID], false);
     EmoMentalCommand.EnableMentalCommandActionsList();
     Debug.Log("Deactive " + array_CogActionList[ActionID]);
     trainClearShow = false;
 }
예제 #3
0
 // Update is called once per frame
 void Update()
 {
     //TODO: if easy mode, else do nothing
     if (currentRoom > 0)
     {
         spawnPoint.transform.position = spawnPointPositions [currentRoom - 1];
     }
     else
     {
         spawnPoint.transform.position = spawnPointPositions [0];
     }
     if (Input.GetKeyDown(KeyCode.M))
     {
         //EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_NEUTRAL,true); //neutral doesnt need enabling
         EmoMentalCommand.StartTrainingMentalCommand(EdkDll.IEE_MentalCommandAction_t.MC_NEUTRAL); // training the neutral command
         Debug.Log("training neutral has started");
         EmoMentalCommand.trainingType = 0;                                                        //to signify that it is neutral
     }
     if (Input.GetKeyDown(KeyCode.T))                                                              //TODO and we are in room 4
     {
         if (!trainingInProgress)
         {
             onTPressed();
         }
     }
 }
    void OnGUI()
    {
        if (trainClearShow)
        {
            if (GUI.Button(new Rect(130 + 230, 20, 50, 20), "Train"))
            {
                OnTrainClick(curAction);
            }
            if (GUI.Button(new Rect(190 + 230, 20, 50, 20), "Clear"))
            {
                OnClearClick(curAction);
            }
        }
        if (GUI.Button(new Rect(250 + 230, 20, 80, 20), "Deactive"))
        {
            OnDeactiveClick(curAction);
        }

        vec2_Scroll = GUI.BeginScrollView(new Rect(120, 20, 225, 80), vec2_Scroll, new Rect(0, 0, 100, 280));

        for (int i = 0; i < 14; i++)
        {
            if (GUI.Button(new Rect(0, i * 20, 210, 20), array_CogActionList[i]))
            {
                curAction = i;
                EmoMentalCommand.EnableMentalCommandAction(EmoMentalCommand.MentalCommandActionList[i], true);
                EmoMentalCommand.EnableMentalCommandActionsList();
                trainClearShow = true;
            }
        }

        GUI.EndScrollView();
    }
예제 #5
0
    /// <summary>
    /// Initiates trainging of mental command, called by Left_Button, Right_Button, and Neutral_Button
    /// </summary>
    /// <param name="type">Command to be trained ("Neutral","Left","Right")</param>
    public void TrainAction(string type)
    {
        LoggerCSV logger = LoggerCSV.GetInstance();

        trainType = type;
        EdkDll.IEE_MentalCommandAction_t toTrain = EdkDll.IEE_MentalCommandAction_t.MC_NEUTRAL;
        cube.SetAciton(cube.ACTION_RESET);
        switch (type)
        {
        case "Left":
            toTrain = EdkDll.IEE_MentalCommandAction_t.MC_LEFT;
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_L);
            break;

        case "Right":
            toTrain = EdkDll.IEE_MentalCommandAction_t.MC_RIGHT;
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_R);
            break;

        default:
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_N);
            break;
        }

        StartCoroutine(UI.UpdateSlider());

        EmoMentalCommand.EnableMentalCommandAction(toTrain, true);
        EmoMentalCommand.EnableMentalCommandActionsList();
        EmoMentalCommand.StartTrainingMentalCommand(toTrain);
    }
예제 #6
0
    /// <summary>
    /// Clear mental command accepted by Accept_Clear_Button,
    /// Clears all data if neutral is cleared
    /// </summary>
    /// <param name="type">Command to be trained ("Neutral","Left","Right")</param>
    public void ClearTraining()
    {
        LoggerCSV logger     = LoggerCSV.GetInstance();
        string    statusText = "Neutral";

        EdkDll.IEE_MentalCommandAction_t action = EdkDll.IEE_MentalCommandAction_t.MC_NEUTRAL;
        switch (trainType)
        {
        case "clear left":
            statusText = "Left";
            action     = EdkDll.IEE_MentalCommandAction_t.MC_LEFT;
            trainType  = "clear left";
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_CLEAR_L);
            break;

        case "clear right":
            statusText = "Right";
            action     = EdkDll.IEE_MentalCommandAction_t.MC_RIGHT;
            trainType  = "clear right";
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_CLEAR_R);
            break;

        default:
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_CLEAR_N);
            UI.UpdateStatusText("Current Aciton: None");
            trainType = "clear neutral";
            Debug.Log(action);
            EraseAction(action);
            //Clear left and right if enabled
            //Left
            if (EmoMentalCommand.MentalCommandActionsEnabled[5])
            {
                Debug.Log("left active - clear");
                EraseAction(EdkDll.IEE_MentalCommandAction_t.MC_LEFT);
            }
            //Right
            if (EmoMentalCommand.MentalCommandActionsEnabled[6])
            {
                Debug.Log("right active - clear");
                EraseAction(EdkDll.IEE_MentalCommandAction_t.MC_LEFT);
            }
            DeactivateRL();
            //Update UI and Training cube
            UI.UpdateStatusText("Cleared " + statusText + " Training Data");
            UI.UpdateUI(trainType);
            cube.SetAciton(cube.ACTION_RESET);
            return;
        }

        EraseAction(action);
        //Deactivate cleared action
        EmoMentalCommand.EnableMentalCommandAction(action, false);
        EmoMentalCommand.EnableMentalCommandActionsList();
        //Update UI and Training cube
        UI.UpdateUI(trainType);
        UI.ActivateButtons(true);
        cube.SetAciton(cube.ACTION_RESET);
        UI.UpdateStatusText("Cleared " + statusText + " Training Data");
    }
예제 #7
0
 // Use this for initialization
 void Start()
 {
     //enable MentalCommand action
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_LIFT, true);
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_PUSH, true);
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_PULL, true);
     EmoMentalCommand.EnableMentalCommandActionsList();
 }
예제 #8
0
    void Update()
    {
        RaycastHit hit;

        cameraLocation  = GetComponentInChildren <Camera> ().transform.position;
        cameraDirection = GetComponentInChildren <Camera>().transform.TransformDirection(Vector3.forward);
        Ray visionRay = new Ray(cameraLocation, cameraDirection);

        Debug.DrawRay(cameraLocation, cameraDirection * 15);

        if (Physics.Raycast(visionRay, out hit, lineOfSight))
        {
            //if the object is a picture and it hasn't been completed yet
            if (hit.collider.tag == "StareTarget")             // && hit.collider.gameObject.GetComponent<MeshRenderer> ().materials [0].color == Color.red) {
            {
                if (!watching)
                {
                    watching   = true;
                    watchTimer = 0f;
                    StartCoroutine(ShowMessage("Started Watching", 1));
                }
                else                     //if you're already watching the picture, carry on with the timer
                {
                    watchTimer += Time.deltaTime;
                    Debug.Log("time: " + watchTimer.ToString());
                    if (watchTimer == 1)
                    {
                        EmoMentalCommand.EnableMentalCommandAction(EmoMentalCommand.MentalCommandActionList[0], true);
                        EmoMentalCommand.StartTrainingMentalCommand(EmoMentalCommand.MentalCommandActionList[0]);                 // mental commandactionlist[0] is neutral, 1 is push
                    }
                    if (watchTimer >= 10)
                    {
                        StartCoroutine(ShowMessage("Completed", 1));
                        hit.collider.gameObject.GetComponent <MeshRenderer> ().materials [0].color = new Color(0f, 1f, 0f, 0.1f);                     //adds a shade of green to the picture with 0.5 alpha
                        hit.collider.gameObject.GetComponent <PictureScript>().isWatched           = true;
                    }
                    if (EmoFacialExpression.isBlink)
                    {
                        //if (Input.GetKeyDown (KeyCode.B)) {  //TODO: switch these after testing
                        StartCoroutine(ShowMessage("Don't Blink When Appreciating Art\nRestarting Timer", 2));
                        watchTimer = 0;
                    }
                    if (!EmoFacialExpression.isEyesOpen)
                    {
                        //watchTimer = 0; //reset the timer if the headset isn't on or the player closes his eyes
                    }
                }
            }
            else                 //in case vision goes to something other than the painting
            {
                watching = false;
                return;
            }
        }
    }
예제 #9
0
    /// <summary>
    /// when the button Train of posActionButton is clicked
    /// </summary>
    /// <param name="posActionButton"></param>
    void OnTrainClick(int posActionButton, int ActionID)
    {
        focusWindow = 100;
        if (!isShowProgessBar)
        {
            timeCount = Time.time;

            isShowProgessBar = true;
        }
        //StartTrainingCognitiv
        EmoMentalCommand.StartTrainingMentalCommand(EmoMentalCommand.MentalCommandActionList[ActionID]);
        Debug.Log(ActionID);
    }
예제 #10
0
    public void onTPressed()
    {
        //to ensure that the player has reached this room
        //if (currentRoom != 5) {
        //	return;
        //}
        //this slowed the code even more^

        //StartTrainingCognitiv
        EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_PUSH, true);
        EmoMentalCommand.StartTrainingMentalCommand(EdkDll.IEE_MentalCommandAction_t.MC_PUSH);         // training the push command
        Debug.Log("training push has started");
        UnpushableCubeScript.moveStarted = true;
        EmoMentalCommand.trainingType    = 1;
    }
예제 #11
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyUp(KeyCode.P))
     {
         EmoMentalCommand.StartTrainingMentalCommand(EdkDll.IEE_MentalCommandAction_t.MC_NEUTRAL);
     }
     if (Input.GetKeyUp(KeyCode.O))
     {
         EmoMentalCommand.StartTrainingMentalCommand(EdkDll.IEE_MentalCommandAction_t.MC_LIFT);
     }
     if (Input.GetKeyUp(KeyCode.I))
     {
         EmoMentalCommand.StartTrainingMentalCommand(EdkDll.IEE_MentalCommandAction_t.MC_PUSH);
     }
     if (Input.GetKeyUp(KeyCode.U))
     {
         EmoMentalCommand.StartTrainingMentalCommand(EdkDll.IEE_MentalCommandAction_t.MC_PULL);
     }
 }
 void OnTrainClick(int ActionID)
 {
     EmoMentalCommand.StartTrainingMentalCommand(EmoMentalCommand.MentalCommandActionList[ActionID]);
 }
예제 #13
0
 /// <summary>
 /// Deactivates Right and Left mental commands
 /// </summary>
 void DeactivateRL()
 {
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_RIGHT, false);
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_LEFT, false);
     EmoMentalCommand.EnableMentalCommandActionsList();
 }