Exemplo n.º 1
0
    void ProcessSales(List <ShopItem> itemsSold)
    {
        // Open Window
        salesSummaryWindow.gameObject.SetActive(true);

        int earnings   = 0;
        int numberSold = itemsSold.Count;

        foreach (ShopItem item in itemsSold)
        {
            earnings += item.mainGameItem.itemProperties.sellPriceFlorets;

            if (item.secondaryGameItem != null)
            {
                earnings += item.secondaryGameItem.itemProperties.sellPriceFlorets;
            }

            // Remove it from the list of items
            itemsForSale.Remove(item);
        }

        salesSummaryWindow.transform.Find("Text_Earnings").GetComponent <Text>().text = "+" + earnings.ToString() + " florets";
        salesSummaryWindow.transform.Find("Text_Summary").GetComponent <Text>().text  = "You sold " + numberSold + " items!";

        Currencies.AddFlorets(earnings);
    }