public void OnButtonClick(string ButtonName) { SoundController.Static.PlayClickSound(); switch (ButtonName) { case "next": showNextcar(); break; case "previous": showPreviouscar(); break; case "play": loadingLevelObj.SetActive(true); Carselectionmenu.SetActive(false); break; case "buycar": purchasecars(); break; case "Back": MainMenu.SetActive(true); Carselectionmenu.SetActive(false); break; } }
void purchasecars() { switch (carIndex) { case 1: if (TotalCoins.staticInstance.totalCoins >= 1000) { buyPopUP.carCost = 1000; //to set the cost in buyPopUpScript buyPopUp.SetActive(true); Carselectionmenu.SetActive(false); } else { InAPPMenu.SetActive(true); Carselectionmenu.SetActive(false); } break; case 2: if (TotalCoins.staticInstance.totalCoins >= 3000) { buyPopUP.carCost = 3000; buyPopUp.SetActive(true); Carselectionmenu.SetActive(false); } else { InAPPMenu.SetActive(true); Carselectionmenu.SetActive(false); } break; case 3: if (TotalCoins.staticInstance.totalCoins >= 4000) { buyPopUP.carCost = 4000; buyPopUp.SetActive(true); Carselectionmenu.SetActive(false); } else { InAPPMenu.SetActive(true); Carselectionmenu.SetActive(false); } break; case 4: if (TotalCoins.staticInstance.totalCoins >= 5000) { buyPopUP.carCost = 5000; buyPopUp.SetActive(true); Carselectionmenu.SetActive(false); } else { InAPPMenu.SetActive(true); Carselectionmenu.SetActive(false); } break; case 5: if (TotalCoins.staticInstance.totalCoins >= 6000) { buyPopUP.carCost = 6000; buyPopUp.SetActive(true); Carselectionmenu.SetActive(false); } else { InAPPMenu.SetActive(true); Carselectionmenu.SetActive(false); } break; } }