Ejemplo n.º 1
0
    public void StartBuilding(string buttonContent)
    {
        Debug.Log("button click: " + buttonContent);
        if (buttonContent == "add-stall")
        {
            if (PlayerEconomy.Money >= Prices.GetStallConstructionPrice(unlockedStalls))
            {
                PlayerEconomy.PayMoney(Prices.GetStallConstructionPrice(unlockedStalls));


                //enable GO, construction
                stalls [unlockedStalls].gameObject.SetActive(true);
                stalls [unlockedStalls].underConstruction.SetActive(true);
                for (int i = 0; i < stalls [unlockedStalls].finished.Length; ++i)
                {
                    stalls [unlockedStalls].finished [i].SetActive(false);
                }

                //store in duration dict. index is nr of unlocked stalls
                constructionDaysRemainingPerStallIndex.Add(unlockedStalls, Durations.GetStallConstructionDuration(unlockedStalls));
                UI.instance.constructionUI.underConstructionDaysRemaining.text = constructionDaysRemainingPerStallIndex[unlockedStalls].ToString() + " " + GetDayPluralSingular(constructionDaysRemainingPerStallIndex[unlockedStalls]) + " remaining";

                unlockedStalls++;

                UI.instance.constructionUI.hideOnConstruction.SetActive(false);
                UI.instance.constructionUI.showOnConstruction.SetActive(true);
            }
            else
            {
                Debug.Log("not enough money for stall construction!");
            }
        }
    }
Ejemplo n.º 2
0
 private void RefillHayCart()
 {
     PlayerEconomy.PayMoney(refillPrice);
     cartToRestock.InitOrRestockCart(cartToRestock.currentUnits + refillUnits);
 }