예제 #1
0
    }    //end of Start

    void OnClick()
    {
        if (costumeOwned == false)                                 //buy button tapped
        {
            if (hInGameScriptCS.getCurrencyCount() >= costumeCost) //check if user has enough currency
            {
                //deduct the cost of costume
                hInGameScriptCS.alterCurrencyCount(-costumeCost);

                //change the texture of the character
                characterMaterial.SetTexture("_MainTex", characterCostume);

                //turn off buy and show equip button
                uilBuyEquipButton.text = "EQUIP";

                //change the costumeOwned
                costumeOwned = true;

                //take the user to the main menu
                hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.MainMenu);
                hNGUIMenuScript.CloseMenu(NGUIMenuScript.NGUIMenus.ShopCostumes);
            }                          //end of if cost == cash
        }
        else if (costumeOwned == true) //equip button tapped
        {
            //change the texture of the character
            characterMaterial.SetTexture("_MainTex", characterCostume);

            //take the user to the main menu
            hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.MainMenu);
            hNGUIMenuScript.CloseMenu(NGUIMenuScript.NGUIMenus.ShopCostumes);
        }
    }    //end of On Click function
예제 #2
0
    }    //end of listener clicks function

    /*
     *	FUNCTION:	Perform function according to the clicked button.
     *	CALLED BY:	listenerClicks()
     */
    private void handlerCostumeItem(Transform buttonTransform)
    {
        if (buttonTransform == tBuyButton)                         //buy button tapped
        {
            if (hInGameScriptCS.getCurrencyCount() >= costumeCost) //check if user has enough currency
            {
                //deduct the cost of costume
                hInGameScriptCS.alterCurrencyCount(-costumeCost);

                //change the texture of the character
                characterMaterial.SetTexture("_MainTex", characterCostume);

                //turn off buy and show the equip button
                tBuyButton.gameObject.SetActive(false);
                tEquipButton.gameObject.SetActive(true);

                //change the costumeOwned
                costumeOwned = true;

                //take the user to the main menu
                hShopScriptCS.displayEquippedCostume();
            }                                     //end of if cost == cash
        }
        else if (buttonTransform == tEquipButton) //equip button tapped
        {
            //change the texture of the character
            characterMaterial.SetTexture("_MainTex", characterCostume);

            //take the user to the main menu
            hShopScriptCS.displayEquippedCostume();
        }
    }
예제 #3
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());
 }
예제 #4
0
    }    //end of listener clicks function

    /*
     *	FUNCTION:	Perform function according to the clicked button.
     *	CALLED BY:	listenerClicks()
     */
    private void handlerIAPItem(Transform buttonTransform)
    {
        if (buttonTransform == tBuyButton)        //if buy button pressed
        {
            //give user the bought amount of in-game currency units
            hInGameScriptCS.alterCurrencyCount(itemReward); //award the purcahsed units
            hShopScriptCS.updateCurrencyOnHeader();         //update the currency on the header bar
        }                                                   //end of if
    }
예제 #5
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
예제 #6
0
    }    //end of listener clicks function

    /*
     *	FUNCTION:	Perform function according to the clicked button.
     *	CALLED BY:	listenerClicks()
     */
    private void handlerUtilityItem(Transform buttonTransform)
    {
        if (buttonTransform == tBuyButton)
        {
            //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
                hShopScriptCS.updateCurrencyOnHeader();         //update the currency on the header bar
            }
        }                                                       //end of if
    }
예제 #7
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
예제 #8
0
    }    //end of listener clicks function

    /*
     *	FUNCTION:	Perform function according to the clicked button.
     *	CALLED BY:	listenerClicks()
     */
    private void handlerPowerupItem(Transform buttonTransform)
    {
        if (buttonTransform == tBuyButton)
        {
            //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
                hShopScriptCS.updateCurrencyOnHeader();            //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
                (this.transform.Find("Text_ItemLevel").GetComponent("TextMesh") as TextMesh).text = "Level " + currentPowerupLevel;
            }
        }        //end of if
    }