<commit_before>﻿using UnityEngine;
using System.Collections;

namespace Assets.BeMoBI.Paradigms.SearchAndFind { 

    /// <summary>
    /// Represents all possible interactions for subject regarding the paradigm or trial behaviour
    /// </summary>
    public class SubjectInteractions : MonoBehaviour {

        private const string SUBMIT_INPUT = "Subject_Submit";

        private const string REQUIRE_PAUSE = "Subject_Requires_Break";

        ParadigmController controller;
        
        void Awake()
        {
            controller = FindObjectOfType<ParadigmController>();
        }

	    // Update is called once per frame
	    void Update () {

            if (Input.GetAxis(SUBMIT_INPUT) > 0)
            {
                controller.SubjectTriesToSubmit();
            }<commit_msg>Implementing controll interface for wiimote control for subjects<commit_after>﻿using UnityEngine;
using System.Collections;
using WiimoteApi;


namespace Assets.BeMoBI.Paradigms.SearchAndFind { 

    /// <summary>
    /// Represents all possible interactions for subject regarding the paradigm or trial behaviour
    /// </summary>
    public class SubjectInteractions : MonoBehaviour {

        private const string SUBMIT_INPUT = "Subject_Submit";

        private const string REQUIRE_PAUSE = "Subject_Requires_Break";

        ParadigmController controller;

        private Wiimote wiimote;

        public bool TestMode = false;

        private bool homeButtonIsDown = false;

        public bool wiimoteDetected = false;

        void Awake()
        {
            controller = FindObjectOfType<ParadigmController>();
        }

	    // Update is called once per frame
	    void Update () {

            if (!WiimoteManager.HasWiimote())
            {
                //if(wiimoteDetected)

                wiimoteDetected = false;
                return;
            }


            wiimote = WiimoteManager.Wiimotes[0];

            wiimoteDetected = true;

            int ret;
            do
            {
                ret = wiimote.ReadWiimoteData();

                if (ret > 0 && wiimote.current_ext == ExtensionController.MOTIONPLUS)
                {
                    Vector3 offset = new Vector3(-wiimote.MotionPlus.PitchSpeed,
                                                    wiimote.MotionPlus.YawSpeed,
                                                    wiimote.MotionPlus.RollSpeed) / 95f; // Divide by 95Hz (average updates per second from wiimote)
                   
                }
            } while (ret > 0);


            // get the Buttons
            if (wiimote.Button.a)
            {
                controller.SubjectTriesToSubmit();
            }

            //model.b.enabled = wiimote.Button.b;

            //model.one.enabled = wiimote.Button.one;
            //model.two.enabled = wiimote.Button.two;

            if (wiimote.Button.d_up)
            {

            }

            //model.d_down.enabled = wiimote.Button.d_down;
            //model.d_left.enabled = wiimote.Button.d_left;
            //model.d_right.enabled = wiimote.Button.d_right;
            //model.plus.enabled = wiimote.Button.plus;
            //model.minus.enabled = wiimote.Button.minus;

            if(TestMode && wiimote.Button.home && !homeButtonIsDown)
            { 
                controller.Restart();
            }

            homeButtonIsDown = wiimote.Button.home;

            if (Input.GetAxis(SUBMIT_INPUT) > 0)
            {
                controller.SubjectTriesToSubmit();
            }
{'fraction_non_alphanumeric': 0.08422837761447145, 'fraction_numerical': 0.0031091011871113624, 'mean_word_length': 1.6002939015429831, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6077770', 'n_tokens_mistral': 1013, 'n_tokens_neox': 914, 'n_words': 197}