private void ChooseProperty_BackToBank(TileController tile) { if (tile) { if (tile.GetType() == typeof(TileController_Country)) { TileController_Country countryTile = (TileController_Country)tile; countryTile.SetupMultiplier(100, countryTile.Owner); countryTile.Owner = null; countryTile.UpgradeLevel(0, playerController, false); countryTile.roundsWithMultiplier = 0; } else { TileController_Wonders countryTile = (TileController_Wonders)tile; countryTile.Owner = null; playerController.photonView.RPC("playerController.walletController.ResetWonder_CMD", Photon.Pun.RpcTarget.All); } } board.ResetBoard(); clicked = true; }
public IEnumerator SetupUpgradeTile(TileController_Country tile, PlayerController player) { var tileBuyable = tile.tile as TileBuyable_Country; int startValue = tile.level; var backgroundHeader = this.transform.Find("BackgroundHeader"); backgroundHeader.GetChild(0).GetComponent <TextMeshProUGUI>().text = tile.tile.nameTile; if (player.botController) { //BOT yield return(player.botController.ExecuteAction(() => { int level = startValue + 1; if (level < 4) { int fullPrice = (int)MathDt.GetContructionPrice(tileBuyable.price, level, tile.level); player.walletController.DebitValue(fullPrice); tile.BuyTile(player, $"{BabelDt.TileLevelName(level)} em: {tile.tile.nameTile}", false); player.firstBuy = true; tile.UpgradeLevel(level, player); } clicked = true; }, null, () => { int randLevel = Random.Range(0, 100); int level = 3; if (randLevel < 30) { level = startValue + 1; } else if (randLevel < 70) { level = startValue + 2; } if (level > 3) { level = 3; } int fullPrice = (int)MathDt.GetContructionPrice(tileBuyable.price, level, tile.level); clicked = true; player.walletController.DebitValue(fullPrice); tile.BuyTile(player, $"{BabelDt.TileLevelName(level)} em: {tile.tile.nameTile}", false); player.firstBuy = true; tile.UpgradeLevel(level, player); })); } else if (tile.level < 3) { this.gameObject.SetActive(true); clicked = false; if (tile.level < 3 && tile.Owner != null && tile.level > 0) { startValue++; } foreach (var aux in buyablePanel) { aux.SetActive(false); } for (int i = startValue; i < 4; i++) { buyablePanel[i].SetActive(true); var content = buyablePanel[i].transform.GetChild(0); int fullPrice = (int)MathDt.GetContructionPrice(tileBuyable.price, i, tile.level); Transform title = content.transform.Find("Title"); Transform icon = content.transform.Find("Icon"); Transform rentRate = content.transform.Find("Rent Rate"); Transform buy = content.transform.Find("Buy"); title.GetComponent <TextMeshProUGUI>().text = constructionName[i]; icon.GetComponent <Image>().sprite = iconHouse[i]; rentRate.GetComponent <TextMeshProUGUI>().text = "Rent rate: <b>$" + MathDt.ConfigureMoney((int)MathDt.GetRentPrice(tileBuyable.price, i)) + "</b>"; buy.GetComponentInChildren <TextMeshProUGUI>().text = "COMPRAR POR\n<size=32>$" + MathDt.ConfigureMoney(fullPrice) + "</size>"; Button buyButton = buy.GetComponentInChildren <Button>(); int level = i; buyButton.onClick.RemoveAllListeners(); buyButton.onClick.AddListener(() => { clicked = true; player.walletController.DebitValue(fullPrice); tile.BuyTile(player, $"{BabelDt.TileLevelName(level)} em: {tile.tile.nameTile}", false);//Message casa player.firstBuy = true; tile.UpgradeLevel(level, player); this.gameObject.SetActive(false); }); if (player.walletController.currentMoney <= fullPrice) { buyButton.interactable = false; } else { buyButton.interactable = true; } } } else { clicked = true; } yield return(new WaitUntil(() => clicked == true)); }