예제 #1
0
    public void ConfirmPurchase()
    {
        if (state == shopState.Confirm)
        {
            // complete purchase
            shopping.CompleteTransaction(purchaseCost, purchaseItem);

            // if item is a one time buy, disable
            if (ShopData.getOneTime(purchaseItem))
            {
                GameObject obj         = GameObject.Find("ShopItem-" + purchaseItem);
                Transform  parentTrans = obj.transform;

                Transform  childTrans = parentTrans.Find("BuyButton");
                GameObject objChild   = childTrans.gameObject;
                Button     b          = objChild.GetComponent <Button>();
                b.interactable = false;

                childTrans = parentTrans.Find("BoughtIndicator");
                objChild   = childTrans.gameObject;
                objChild.SetActive(true);
            }

            state = shopState.Ready;
        }
    }