Ejemplo n.º 1
0
        private void SetupDemolishButton(AbstractBuildingTile tile, AbstractMarketManager manager)
        {
            int price = tile.GetCurrentSoilData().RemoveCost;

            demolishText.text = price.ToString();

            if (!CanAffort(price) || tile.HasFoundation)
            {
                BlockButton(btnDemolish, true);
                return;
            }

            BlockButton(btnDemolish, false);

            SetButton(btnDemolish, OnClick);

            void OnClick()
            {
                confirmDemolishPopup.ShowPopUp(OnConfirmDemolish);
            }

            void OnConfirmDemolish()
            {
                ReduceMoney(price);
                tile.RemoveSoil();
                manager.CloseMarket();
            }
        }