Exemple #1
0
    public static void playSFX(string sfx, int duration)
    {
        if (!fxSource)
        {
            fxSource = GameObject.Find("Sound/FX").GetComponent(typeof(AudioSource)) as AudioSource;
        }
        AudioSource dupSource = Instantiate(fxSource);
        AudioClip   clip      = (AudioClip)Resources.Load <AudioClip>(sfx);

        dupSource.clip = clip;

        if (clip)
        {
            dupSource.PlayOneShot(clip);
            useless mb = dupSource.gameObject.AddComponent(typeof(useless)) as useless;
            mb.StartCoroutine(WaitAndStop(duration, dupSource, mb));
        }
        else
        {
            Debug.LogError("no sfx associated with " + sfx);
        }
    }
Exemple #2
0
    public List<useless> GetTable()
    {
        List<useless> listTable = new List<useless>();

        String query = "Select Id from table1";
        if (this.OpenConnection() == true)
        {
            //create command and assign the query and connection from the constructor
            MySqlCommand cmd = new MySqlCommand(query, connection);

            //Execute command
            MySqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                useless TableList = new useless();
                TableList.userId = rdr["Id"].ToString();

                listTable.Add(TableList);

            }

            return listTable;

            //close connection

        }
        else
            return null;
    }