Ejemplo n.º 1
0
    IEnumerator SpawnStockCoins()
    {
        yield return(new WaitForSeconds(0.5f));

        while (stockValue >= 50)
        {
            stockValue -= 50;
            personalStock.AddCommodity(coinTypes[5]);
            yield return(new WaitForSeconds(0.05f));
        }
        while (stockValue >= 20)
        {
            stockValue -= 20;
            personalStock.AddCommodity(coinTypes[4]);
            yield return(new WaitForSeconds(0.05f));
        }
        while (stockValue >= 10)
        {
            stockValue -= 10;
            personalStock.AddCommodity(coinTypes[3]);
            yield return(new WaitForSeconds(0.05f));
        }
        while (stockValue >= 5)
        {
            stockValue -= 5;
            personalStock.AddCommodity(coinTypes[2]);
            yield return(new WaitForSeconds(0.05f));
        }
        while (stockValue >= 2)
        {
            stockValue -= 2;
            personalStock.AddCommodity(coinTypes[1]);
            yield return(new WaitForSeconds(0.05f));
        }
        while (stockValue >= 1)
        {
            stockValue -= 1;
            personalStock.AddCommodity(coinTypes[0]);
            yield return(new WaitForSeconds(0.05f));
        }
    }