Example #1
0
    public void Awake()
    {
        // get game objects
        GameObject player = GameObject.Find("Player");

        sp = player.GetComponent <SP_FlashLED>();
        dl = player.GetComponent <DL_FlashLED>();
    }
Example #2
0
    public void Awake()
    {
        player = GameObject.Find("Player");
        rr     = player.GetComponent <RR_FlashLED>();
        dl     = player.GetComponent <DL_FlashLED>();
        pc     = player.GetComponent <PC_FlashLED>();
        ttls   = player.GetComponent <SbxTTLs_FlashLED>();

        today = DateTime.Today;
        Debug.Log(today.ToString("dd_MM_yyyy"));
        sceneName       = SceneManager.GetActiveScene().name;
        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;

        session = 1;
        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, LEDCue INT, dz REAL, lick INT, reward INT, gng INT, scanning NUMERIC, manrewards INT)";
        _command.ExecuteNonQuery();
    }