Beispiel #1
0
        private void SetupDemolishButton(AbstractBuildingTile tile, AbstractMarketManager manager)
        {
            int price = tile.Building.Data.DestructionCost;

            demolishText.text = price.ToString();

            if (!CanAffort(price))
            {
                BlockButton(btnDemolish);
                return;
            }

            UnblockButton(btnDemolish);

            SetButton(btnDemolish, OnClick);

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

            void OnConfirmDemolish()
            {
                tile.Building.RemoveBuilding();
                tile.SpawnSoil();
                tile.SpawnFoundation();
                manager.CloseMarket();
            }
        }
 protected override void BuyButtonClick(AbstractBuildingTile tile, AbstractMarketManager manager)
 {
     EventManager.Instance.RaiseEvent(new BuyPlotEvent());
     tile.SpawnSoil();
     base.BuyButtonClick(tile, manager);
 }