Exemple #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)
 {
     tile.SpawnFoundation();
     base.BuyButtonClick(tile, manager);
     EventManager.Instance.RaiseEvent(new FoundationBuildEvent());
 }