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 void ResetWonder_CMD(int index) { TileController_Wonders tile = controller.manager.board.tileControllers.Find(n => n.index == index) as TileController_Wonders; tile.Owner = null; }
public IEnumerator SetupWonderTile(TileController_Wonders tile, PlayerController player) { if (!player.botController) { this.gameObject.SetActive(true); } clicked = false; var backgroundHeader = this.transform.Find("BackgroundHeader"); backgroundHeader.GetChild(0).GetComponent <TextMeshProUGUI>().text = tile.tile.nameTile; var tileWonder = tile.tile as TileBuyable_Wonder; var content = wonderPanel.transform.GetChild(0); int price = MathDt.wonderPrice; Transform title = content.transform.Find("Title"); Transform icon = content.transform.Find("Icon"); Transform buy = content.transform.Find("Buy"); title.GetComponent <TextMeshProUGUI>().text = tileWonder.nameTile; icon.GetComponent <Image>().sprite = tileWonder.icon; buy.GetComponentInChildren <TextMeshProUGUI>().text = "COMPRAR POR\n<size=32>$" + MathDt.ConfigureMoney(price) + "</size>"; Button buyButton = buy.GetComponent <Button>(); buyButton.onClick.RemoveAllListeners(); buyButton.onClick.AddListener(() => { clicked = true; player.walletController.DebitValue(price); tile.BuyTile(player, $"{tile.tile.nameTile} e agora possui {player.wondersInControl + 1} maravilhas!", false);//MESSAGE WONDER player.firstBuy = true; player.wondersInControl++; player.WonderWin(); this.gameObject.SetActive(false); }); if (player.walletController.currentMoney <= price) { buyButton.interactable = false; } else { buyButton.interactable = true; } //BOT if (player.botController) { yield return(player.botController.ExecuteAction(() => { clicked = true; player.walletController.DebitValue(price); tile.BuyTile(player, $"{tile.tile.nameTile} e agora possui {player.wondersInControl + 1} maravilhas!", false);//MESSAGE WONDER player.firstBuy = true; player.wondersInControl++; player.WonderWin(); }, () => { })); } yield return(new WaitUntil(() => clicked == true)); }
public IEnumerator SetupRentWonderTile(TileController_Wonders tile, PlayerController player) { if (!player.botController) { this.gameObject.SetActive(true); } clicked = false; var tileWonder = tile.tile as TileBuyable_Wonder; int price = (int)MathDt.GetWonderRentPrice(tile.Owner.wondersInControl); Transform payRent = rentPanel.transform.GetChild(0).Find("Pay"); payRent.GetComponentInChildren <TextMeshProUGUI>().text = "Pagar aluguel de $" + MathDt.ConfigureMoney(price); Button rentButton = payRent.GetComponentInChildren <Button>(); var backgroundHeader = this.transform.Find("BackgroundHeader"); backgroundHeader.GetComponent <Image>().color = tile.Owner.mainColor; backgroundHeader.GetChild(0).GetComponent <TextMeshProUGUI>().text = tile.tile.nameTile; rentButton.onClick.RemoveAllListeners(); rentButton.onClick.AddListener(() => { clicked = true; player.walletController.DebitValue(price); tile.Owner.walletController.CreditValue(price); this.gameObject.SetActive(false); }); int hostilePrice = MathDt.hostileWonderTakeoverPrice; Transform payHostile = hostileTakeoverPanel.transform.GetChild(0).Find("Buy"); payHostile.GetComponentInChildren <TextMeshProUGUI>().text = "Compra hostil por $" + MathDt.ConfigureMoney(hostilePrice); Button hostileButton = payHostile.GetComponentInChildren <Button>(); hostileButton.onClick.RemoveAllListeners(); hostileButton.onClick.AddListener(() => { clicked = true; player.walletController.DebitValue(hostilePrice); tile.Owner.walletController.CreditValue(MathDt.wonderPrice); tile.BuyTile(player, $"{player.name} realizou uma aquisição hostil em: {tile.tile.nameTile}. Sendo {MathDt.wonderPrice} para {tile.Owner.name} e {hostilePrice} em impostos. e agora possui {player.wondersInControl + 1} maravilhas!", true); tile.Owner = player; this.gameObject.SetActive(false); }); if (player.walletController.currentMoney <= hostilePrice) { hostileButton.interactable = false; } else { hostileButton.interactable = true; } //BOT if (player.botController) { yield return(player.botController.ExecuteAction(() => { clicked = true; player.walletController.DebitValue(price); tile.Owner.walletController.CreditValue(price); }, null, () => { clicked = true; player.walletController.DebitValue(hostilePrice); tile.Owner.walletController.CreditValue(MathDt.wonderPrice); tile.Owner = player; })); } yield return(new WaitUntil(() => clicked == true)); }