void OnClick() { //give user the bought amount of in-game currency units hInGameScriptCS.alterCurrencyCount(itemReward); //award the purcahsed units //update the currency on the header bar hNGUIMenuScript.updateCurrencyOnHeader(hNGUIMenuScript.getCurrentMenu()); }
void OnClick() { //give the utility to user and deduct the item cost if (hInGameScriptCS.getCurrencyCount() >= itemCost) //check if user has enough currency { hInGameScriptCS.alterCurrencyCount(-itemCost); //deduct the cost of utility //update the currency on the header bar hNGUIMenuScript.updateCurrencyOnHeader(hNGUIMenuScript.getCurrentMenu()); } } //end of On Click function
void OnClick() { //increase the powerup level if (currentPowerupLevel < powerupUpgradeLevelMAX && //check if the max level has not been achieved hInGameScriptCS.getCurrencyCount() >= upgradeCost) //check if user has enough currency { currentPowerupLevel++; //increase the power-up level hInGameScriptCS.alterCurrencyCount(-upgradeCost); //deduct the cost of power-up upgrade hNGUIMenuScript.updateCurrencyOnHeader(hNGUIMenuScript.getCurrentMenu()); //update the currency on the header bar //tell the power-up script to increase the duration of the power-up hPowerupsMainControllerCS.upgradePowerup(powerup); //Update the text on the power-up item in shop uilLevelText.text = "Level " + currentPowerupLevel; } } //end of On Click
void OnClick() { if (hNGUIMenuScript.getCurrentMenu() == NGUIMenuScript.NGUIMenus.GameOverMenu) //if this is GameOver menu { hInGameScriptCS.procesClicksDeathMenu(MenuScriptCS.GameOverMenuEvents.Back); } else if (hNGUIMenuScript.getCurrentMenu() == NGUIMenuScript.NGUIMenus.PauseMenu) //if this is Pause menu { hInGameScriptCS.processClicksPauseMenu(MenuScriptCS.PauseMenuEvents.MainMenu); } else if (hNGUIMenuScript.getCurrentMenu() == NGUIMenuScript.NGUIMenus.ShopCostumes || //if Shop Costumes menu is active hNGUIMenuScript.getCurrentMenu() == NGUIMenuScript.NGUIMenus.ShopIAPs || //if Shop IAPs menu is active hNGUIMenuScript.getCurrentMenu() == NGUIMenuScript.NGUIMenus.ShopPowerups || //if Shop Powerups menu is active hNGUIMenuScript.getCurrentMenu() == NGUIMenuScript.NGUIMenus.ShopUtilities) //if Shop Utilities menu is active { hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.ShopHome); //show the Shop Home menu NGUITools.SetActive(this.transform.parent.gameObject, false); //hide the current menu } else { hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.MainMenu); //show the main menu NGUITools.SetActive(this.transform.parent.gameObject, false); //hide the current menu } //end of else } //end of OnClick function