Beispiel #1
0
    public void Awake()
    {
        GameObject player = GameObject.Find("Player");

        sp     = player.GetComponent <SP_TwoTower>();
        rotary = player.GetComponent <RR_TwoTower>();
        dl     = player.GetComponent <DL_TwoTower>();
        Debug.Log(sp.sceneName);
        if (sp.sceneName == "TwoTower_foraging")
        {
            reward = GameObject.Find("Reward");
        }
        else
        {
            reward0 = GameObject.Find("Reward0");
            reward1 = GameObject.Find("Reward1");
        }



        panoCam = GameObject.Find("panoCamera");
        panoCam.transform.eulerAngles = new Vector3(0.0f, -90.0f, 0.0f);
        initialPosition = new Vector3(0f, 6f, -50.0f);


        towerJitter  = .2f * (UnityEngine.Random.value - .5f);
        wallJitter   = .2f * (UnityEngine.Random.value - .5f);
        bckgndJitter = .2f * (UnityEngine.Random.value - .5f);

        LickHistory = new ArrayList();
    }
Beispiel #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();
    }