Пример #1
0
 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());
 }
Пример #2
0
 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
Пример #3
0
    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