Question by 
               generalzaza · Apr 29, 2021 at 01:19 PM · 
                unity 5scripting problembuttonsbutton trigger events  
              
 
              Wanting make shop system, how can I disable this condition after item sold?
Hello guys, I have a problem with this script. I made a buy button to buy something. It works but I want to make this system not working after I clicked once. Here is my script, I received Index value to choose which item is selected. I want to make this into these if statements. I tried to make with bool but I couldn't. How can I do that?
Thank you!
 public void BuyButton()
 {
     switch (index)
     {
         case 0:
             if (//Item has not sold)
             {
                 moneyAmount -= firstMoneyOfRocket;
                 PlayerPrefs.SetFloat("Cash", moneyAmount);
             }
             else if (//Item sold)
             {
                 Debug.Log("You already bought this item.");
             }
             break;
         case 1:
             if(//Item hasnt sold)
             {
                 moneyAmount -= secondMoneyOfRocket;
                 PlayerPrefs.SetFloat("Cash", moneyAmount);
             }
             else if (//ItemSold)
             {
                 Debug.Log("You already bought this item.");
             }
             break;
     }
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                