public void TavernCardLogic(int i) { SkipButton.onClick.RemoveAllListeners(); BuyButton.onClick.RemoveAllListeners(); OkButton.onClick.RemoveAllListeners(); Propertyname.SetActive(true); player = gameObject.name; // Debug.Log(player); if (player == "Player1") { active_player = 1; } if (player == "Player2") { active_player = 2; } // Debug.Log(active_player); int owner = MoneyHandle.GetTavernOwner(i); Info.SetActive(true); Info2.SetActive(true); if (owner == 0) { Buy.SetActive(true); Skip.SetActive(true); BuyButton.onClick.AddListener(() => BuyTavern(i)); SkipButton.onClick.AddListener(Reset); Text_Info2.text = "Price: 200 "; Text_Info.text = "This tavern is for sale. Would you like to buy? "; } else if (owner == active_player) { Ok.SetActive(true); Text_Info.text = "You are the owner of this tavern!"; Text_Info2.text = ""; OkButton.onClick.AddListener(() => Reset()); } else { Dice.SetActive(false); Buy.SetActive(false); Skip.SetActive(false); Debug.Log("PAY UP SON! RENT IS: " + MoneyHandle.GetTavernRent(i)); Text_Info.text = "PAY UP SON! Tavern is owned by player " + owner; Text_Info2.text = "Rent: " + MoneyHandle.GetTavernRent(active_player); //bool success = MoneyHandle.PayRent(active_player, i); Ok.SetActive(true); OkButton.onClick.AddListener(() => PayTavernRent(active_player, i)); } }
public void PayTavernRent(int player, int i) { bool success = MoneyHandle.PayTavernRent(active_player, i); if (success == true) { Debug.Log("Payment successful (tavern). player: " + active_player); Reset(); } }
public void Payrent(int player, int i) { bool success = MoneyHandle.PayPropertyRent(active_player, i); if (success == true) { Debug.Log("Payment successful (PropertyRent). player: " + active_player); Reset(); } }
public void Tax(int player) { Dice.SetActive(false); Ok.SetActive(true); Info.SetActive(true); Info2.SetActive(true); Text_Info.text = "You were caught by the tax bear!"; Text_Info2.text = "Pay 200 coins!"; OkButton.onClick.RemoveAllListeners(); OkButton.onClick.AddListener(() => MoneyHandle.SubtractMoney(player, 200)); OkButton.onClick.AddListener(() => Reset()); }
void Start() { SkipButton.onClick.AddListener(Reset); MoneyHandle moneyHandle = GameObject.FindObjectOfType(typeof(MoneyHandle)) as MoneyHandle; // MoneyHandle.AddMoney(1, 100000); // MoneyHandle.AddMoney(2, 1000); Reset(); // int Rent = MoneyHandle.GetTavernRent(1); //Debug.Log("for player 1 tavern = " + Rent); //int Rent2 = MoneyHandle.GetTavernRent(2); //Debug.Log("for player 2 tavern = " + Rent2); }
public void Buyhouse(int player, int index) { int level = MoneyHandle.GetPropertyLevel(index); if (level == 5) { Text_Info2.text = "Max amount!"; Buy.SetActive(false); } else if (level < 5) { bool success = MoneyHandle.BuyHouse(active_player, index); if (success == true) { Text_Info2.text = "House bought!"; } else if (success == false) { Text_Info2.text = "Not Enough money."; } } }
public void BuyTavern(int i) { bool success = MoneyHandle.BuyTavern(active_player, i); if (success == true) { Debug.Log("Successful buy (tavern) - " + active_player); Buy.SetActive(false); Ok.SetActive(true); Skip.SetActive(false); Text_Info.text = "Tavern is yours!"; OkButton.onClick.AddListener(Reset); } else if (success == false) { Debug.Log("NOT ENOUGH MONEH BOIII- " + active_player); Text_Info2.text = "No money!"; //Text_Info2.text = "Price: 200"; SkipButton.onClick.AddListener(Reset); } }
public void Chance(int player) { int Rand = Random.Range(0, 9); //Debug.Log("sattumana tuli: " + Rand); SkipButton.onClick.RemoveAllListeners(); BuyButton.onClick.RemoveAllListeners(); OkButton.onClick.RemoveAllListeners(); Dice.SetActive(false); Ok.SetActive(true); Info.SetActive(true); Info2.SetActive(true); switch (Rand) { case 0: Debug.Log("Chance (-100)"); Text_Info.text = "You were robbed by forest bandits!"; Text_Info2.text = "Lost 100 coins."; OkButton.onClick.AddListener(() => MoneyHandle.SubtractMoney(player, 100)); OkButton.onClick.AddListener(() => Reset()); break; case 1: Debug.Log("Chance (-75)"); Text_Info.text = "You were robbed by forest bandits!"; Text_Info2.text = "Lost 75 coins."; OkButton.onClick.AddListener(() => MoneyHandle.SubtractMoney(player, 75)); OkButton.onClick.AddListener(() => Reset()); break; case 2: Debug.Log("Chance (-50)"); Text_Info.text = "You were robbed by forest bandits!"; Text_Info2.text = "Lost 50 coins."; OkButton.onClick.AddListener(() => MoneyHandle.SubtractMoney(player, 50)); OkButton.onClick.AddListener(() => Reset()); break; case 3: Debug.Log("Chance (-25)"); Text_Info.text = "You found a hole in your pocket!"; Text_Info2.text = "Lost 25 coins."; OkButton.onClick.AddListener(() => MoneyHandle.SubtractMoney(player, 25)); OkButton.onClick.AddListener(() => Reset()); break; case 4: Debug.Log("Chance (nothing happens)"); Text_Info.text = "Nothing happens."; Info2.SetActive(false); OkButton.onClick.AddListener(() => Reset()); break; case 5: Debug.Log("Chance (+25)"); Text_Info.text = "You found a small pouch of money!"; Text_Info2.text = "Gain 25 coins."; OkButton.onClick.AddListener(() => MoneyHandle.AddMoney(player, 25)); OkButton.onClick.AddListener(() => Reset()); break; case 6: Debug.Log("Chance (+50)"); Text_Info.text = "You won a travelling merchant in dice!"; Text_Info2.text = "Gain 50 coins."; OkButton.onClick.AddListener(() => MoneyHandle.AddMoney(player, 50)); OkButton.onClick.AddListener(() => Reset()); break; case 7: Debug.Log("Chance (+75)"); Text_Info.text = "You found a large sack of money!"; Text_Info2.text = "Gain 75 coins."; OkButton.onClick.AddListener(() => MoneyHandle.AddMoney(player, 75)); OkButton.onClick.AddListener(() => Reset()); break; case 8: Debug.Log("Chance (+100)"); Text_Info.text = "You found a pot of leprechauns gold at the end of a rainbow!"; Text_Info2.text = "Gain 100 coins."; OkButton.onClick.AddListener(() => MoneyHandle.AddMoney(player, 100)); OkButton.onClick.AddListener(() => Reset()); break; } }
public void PropertyCardLogic(int i) { // if (Player1.GetComponent<FollowThePath>().moveAllowed == false && Player2.GetComponent<FollowThePath>().moveAllowed == false) //{ SkipButton.onClick.RemoveAllListeners(); BuyButton.onClick.RemoveAllListeners(); OkButton.onClick.RemoveAllListeners(); Propertyname.SetActive(true); player = gameObject.name; // Debug.Log(player); if (player == "Player1") { active_player = 1; } if (player == "Player2") { active_player = 2; } // Debug.Log(active_player); int owner = MoneyHandle.GetPropertyOwner(i); Info.SetActive(true); Info2.SetActive(true); if (owner == 0) { Buy.SetActive(true); Skip.SetActive(true); BuyButton.onClick.AddListener(() => BuyProperty(i)); SkipButton.onClick.AddListener(Reset); Text_Info2.text = "Price: " + MoneyHandle.GetPrice(i); Text_Info.text = "This property is for sale. Would you like to buy? "; } else if (owner == active_player) { Buy.SetActive(false); bool GroupOwner = MoneyHandle.CheckGroup(active_player, i); if (GroupOwner == true) { Text_Info.text = "You own this village. Would you like to buy a house?"; Text_Info2.text = "Price: " + MoneyHandle.GetHousePrice(i); Buy.SetActive(true); Skip.SetActive(true); BuyButton.onClick.AddListener(() => Buyhouse(active_player, i)); SkipButton.onClick.AddListener(() => Reset()); } else if (GroupOwner == false) { Info2.SetActive(false); Text_Info.text = "You own this property! You need all village properties to buy houses."; OkButton.onClick.AddListener(() => Reset()); Ok.SetActive(true); } } else { Dice.SetActive(false); Buy.SetActive(false); Skip.SetActive(false); Debug.Log("PAY UP SON! RENT IS: " + MoneyHandle.GetPropertyRent(i)); Text_Info.text = "PAY UP SON! Property is owned by player " + owner; Text_Info2.text = "Rent: " + MoneyHandle.GetPropertyRent(i); // bool success = MoneyHandle.PayRent(active_player, i); Ok.SetActive(true); OkButton.onClick.AddListener(() => Payrent(active_player, i)); // } } }