Example #1
0
    // public function to use in Spoiler button OnClick() in his inspector
    public void SelectSpoiler(int id)
    {
        if (PlayerPrefs.GetInt(spoilers.carID.ToString() + "Spoiler" + id.ToString()) == 3)              // 3=>true , 0=>false

        // Find current car T_Spoilers component
        {
            spoilers = GameObject.FindObjectOfType <T_Spoiler> ();

            // And then activate current selected Spoiler:
            spoilers.SetSpoiler(id, true);

            PlayerPrefs.SetInt(spoilers.carID.ToString() + "SpoilerID", id);

            tShop.ShowWindow(false);
        }
        else            // The current selected Spoiler is not unlocked, We unlock it with reducing money from player total moneys and unlock Spoiler


        // Find current car T_Spoilers component
        {
            spoilers = GameObject.FindObjectOfType <T_Spoiler> ();

            // And then activate current selected Spoiler:
            spoilers.SetSpoiler(id, true);

            tShop.carID  = spoilers.carID;
            tShop.itemID = id;
            //	tShop.currentItemPrice.text = tShop.exhaustPrice [id].ToString();
            tShop.itemType = ItemType.Spoiler;
            tShop.ShowWindow(true);
        }
    }
Example #2
0
    // public function to use in car selection ui manu
    public void UpdateLocks()
    {
        spoilers = GameObject.FindObjectOfType <T_Spoiler> ();

        for (int a = 0; a < tShop.spoilerPrice.Length; a++)
        {
            tShop.spoilerLocks  [a].SetActive(true);

            if (PlayerPrefs.GetInt(spoilers.carID.ToString() + "Spoiler" + a.ToString()) == 3)
            {
                // Deactivate pre unlocked exhausts icon
                tShop.spoilerLocks  [a].SetActive(false);
            }
        }
    }