public void Show(Props prop) { TitleImg.GetComponent <Image>().color = Color.black; Place.text = prop.Name(); Cost.text = "Cost $ " + prop.Cost(); Rent.text = "Rent $ " + prop.Rent(); BuyOrSell.text = "Buy"; Card.transform.DOScale(1.0f, 0.5f); }
void ToTransaction() { int index = m_CurrentPlayer.GetCurrentCell(); PlayerType owner = m_CurrentProperty.Owner(); Props.PropertyType propertyType = m_CurrentProperty.Type(); /* If Landed on Jail */ if (propertyType == Props.PropertyType.Jail && m_CurrentProperty.Name() == "Jail") { app.view.GoToJail(m_CurrentPlayerIndex, m_CurrentPlayer); Go(HSM.State.CompleteTransaction); return; } else if (owner == PlayerType.Bank) { bool isAvailable = m_CurrentProperty.CanBuy(); bool canAfford = m_CurrentPlayer.CanPay(m_CurrentProperty.Cost()); /* Certain Bank Properties like Tax, Community Cards, Jail, Chance etc or not available to buy*/ if (isAvailable) { if (canAfford) /* If player can afford to buy a property show buy dialog */ { app.view.ShowBuyDialog(m_CurrentProperty); if (m_CurrentPlayer.m_AI) { Invoke("OnBuySell", 0.5f); } } else { Go(HSM.State.CompleteTransaction); } } else { PayRent(index, new Dictionary <string, string>()); } } else if (owner == m_CurrentPlayer.m_Player) { Go(HSM.State.CompleteTransaction); } else { Dictionary <string, string> param = new Dictionary <string, string>(); if (propertyType == Props.PropertyType.Transport) { int count = app.model.GetBuildingsOwnedByPlayer(propertyType, owner); param.Add("count", count.ToString()); } else if (propertyType == Props.PropertyType.Utility) { int count = app.model.GetBuildingsOwnedByPlayer(propertyType, owner); param.Add("count", count.ToString()); param.Add("dicevalue", m_CurrentPlayer.m_LastDiceRoll.ToString()); } else if (propertyType == Props.PropertyType.Turn) { GoPassed(); Go(HSM.State.CompleteTransaction); return; } PayRent(index, param); } }