Exemplo n.º 1
0
    void Awake()
    {
        player = GameObject.Find("Player");
        sp     = player.GetComponent <SP_TwoTower>();
        pc     = player.GetComponent <PC_TwoTower>();
        //to = player.GetComponent<DebiasingAlg_TwoTower>();
        to = player.GetComponent <TrialOrdering_TwoTower>();

        baseline_half  = (int)to.numBaselineTrials / 2;
        baseline_quart = (int)Mathf.Min(to.numBaselineTrials / 4, 10f);
    }
Exemplo n.º 2
0
    public void Awake()
    {
        player    = GameObject.Find("Player");
        sceneName = SceneManager.GetActiveScene().name;

        if (sceneName == "TwoTower_4Way")
        {
            dbtt_4way = player.GetComponent <DebiasingAlg_TwoTower_4Way>();
        }
        else if (sceneName == "FreqMorph_Decision")
        {
            dbfm = player.GetComponent <DebiasingAlg_FreqMorph>();
        }
        else
        {
            if (player.GetComponent <TrialOrdering_TwoTower>() != null)
            {
                tott      = player.GetComponent <TrialOrdering_TwoTower>();
                orderBool = false;
            }
            else
            {
                dbtt = player.GetComponent <DebiasingAlg_TwoTower>();

                orderBool = true;
            }
        }

        rr    = player.GetComponent <RR_TwoTower>();
        dl    = player.GetComponent <DL_TwoTower>();
        pc    = player.GetComponent <PC_TwoTower>();
        ttls  = player.GetComponent <SbxTTLs_TwoTower>();
        notes = player.GetComponent <Notes>();
        mouse = notes.mouse;


        today = DateTime.Today;
        Debug.Log(today.ToString("dd_MM_yyyy"));



        localDirectory  = localDirectory_pre + mouse + '/' + today.ToString("dd_MM_yyy") + '/';
        serverDirectory = serverDirectory_pre + mouse + '/' + today.ToString("dd_MM_yyy") + '/';
        if (!Directory.Exists(localDirectory))
        {
            Directory.CreateDirectory(localDirectory);
        }
        if (!Directory.Exists(serverDirectory))
        {
            Directory.CreateDirectory(serverDirectory);
        }



        bool nameFlag = true;

        while (nameFlag)
        {
            localPrefix  = localDirectory + "/" + sceneName + "_" + session.ToString();
            serverPrefix = serverDirectory + "/" + sceneName + "_" + session.ToString();
            if (File.Exists(localPrefix + ".sqlite"))
            {
                session++;
            }
            else
            {
                nameFlag = false;
                SqliteConnection.CreateFile(localPrefix + ".sqlite");
            }
        }

        string connectionString = "Data Source=" + localPrefix + ".sqlite;Version=3;";

        _connection = (IDbConnection) new SqliteConnection(connectionString);
        _connection.Open();
        _command             = _connection.CreateCommand();
        _command.CommandText = "create table data (time REAL, morph REAL, trialnum INT, pos REAL, dz REAL, lick INT, reward INT," +
                               "tstart INT, teleport INT, rzone INT, toutzone INT, clickOn NUMERIC, blockWalls NUMERIC, towerJitter REAL," +
                               " wallJitter REAL, bckgndJitter REAL, scanning NUMERIC, manrewards INT, cmd INT)";
        _command.ExecuteNonQuery();

        // make table for session information

        // trial type numbers
        _command.CommandText = "create table trialInfo (baseline INT, training INT, test INT)";
        _command.ExecuteNonQuery();

        // if (sceneName == "TwoTower_4Way")
        //{
        //    _command.CommandText = "insert into trialInfo (baseline, training, test) values (" + dbtt_4way.numBaselineTrials + ", " + dbtt_4way.numTrainingTrials + ", " + dbtt_4way.numTestTrials + ")";
        //}
        //else if (sceneName == "FreqMorph_Decision")
        // {
        //    _command.CommandText = "insert into trialInfo (baseline, training, test) values ( 0 , " + dbfm.numTrainingTrials + ", " + db.numTestTrials + ")";
        //} else
        //{
        //   if (orderBool)
        // {
        //    _command.CommandText = "insert into trialInfo (baseline, training, test) values (" + dbtt.numBaselineTrials + ", " + dbtt.numTrainingTrials + ", " + dbtt.numTestTrials + ")";
        // }
        //else
        //{
        //   _command.CommandText = "insert into trialInfo (baseline, training, test) values (" + tott.numBaselineTrials + ", " + tott.numTrainingTrials + ", " + tott.numTestTrials + ")";
        // }

        // }
        //_command.ExecuteNonQuery();
    }