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()); }
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; } }