Exemple #1
0
    // method to buy money in game
    public IEnumerator buyItem()
    {
        Transform _button = transform.FindChild("BuyTeethButton");

        StoreAudioButton.shared().playAudio();

        _button.localScale = new Vector3(1.05f, 1.05f, 1.0f);

        yield return(new WaitForSeconds(0.1f));

        _button.localScale = new Vector3(1.0f, 1.0f, 1.0f);

        BillingManager.buyItem(this.id);
    }
Exemple #2
0
    // method to buy item of the game
    public IEnumerator buyItem()
    {
        // find buyButton gameObject to change the scale
        Transform _button = transform.FindChild("BlackSquare").FindChild("BuyButton");

        StoreAudioButton.shared().playAudio();

        _button.localScale = new Vector3(1.05f, 1.05f, 1.0f);

        // wait some seconds to change back the scale
        yield return(new WaitForSeconds(0.1f));

        _button.localScale = new Vector3(1.0f, 1.0f, 1.0f);

        // removes the price from money manager if the money is enough
        if (MoneyTeeth.removeTeeth(storeItem.Price))
        {
            // load new teeth amount
            LoadStore.shareLoadStore().loadTeethAmount();

            // to receive the items bought
            ArrayList _cloakRoomList = new ArrayList();

            // check if there are
            if (SaveSystem.hasObject("CloakRoom_List"))
            {
                _cloakRoomList = (ArrayList)SaveSystem.load("CloakRoom_List", typeof(ArrayList));
            }

            // add the new item bought
            _cloakRoomList.Add(storeItem);

            // save the new list
            SaveSystem.save("CloakRoom_List", _cloakRoomList);

            // remove all objects in the scene
            LoadStore.shareLoadStore().clearStoreItems();

            // and load again
            LoadStore.shareLoadStore().loadStoreItems();
        }
        else          // if the money isn't enough, show message

        {
            Message.sharedMessage().setText("Dente insuficiente").show();
        }
    }