public void BuyProduct()
    {
        bool   bought   = false;
        string currency = "";

        if (product.realMoney)
        {
            //pass the product ID to the in app purchase manager
            return;
        }
        else if (product.pCheese)
        {
            bought   = grm.EarnOrSpendCheese(-(int)product.payAmount);
            currency = "cheese";
        }
        else
        {
            bought   = grm.EarnOrSpendCoin(-(int)product.payAmount);
            currency = "coins";
        }

        if (bought)
        {
            ReceiveProduct();
        }
        else
        {
            messagePanel.NotEnoughMoney(currency);
        }
    }
Exemple #2
0
    public void BuyItem()
    {
        bool   bought = false;
        string currency;

        if (accessory.isCoin)
        {
            bought   = grm.EarnOrSpendCoin(-accessory.price);
            currency = "coins";
        }
        else
        {
            bought   = grm.EarnOrSpendCheese(-accessory.price);
            currency = "cheese";
        }

        if (bought == true)
        {
            BuyItemSuccessful();
        }
        else
        {
            messagePanel.NotEnoughMoney(currency);
        }
    }
    public void ToNextLevel()
    {
        if (levelComplete)
        {
            drawLine.enabled = false;
            player.enabled   = false;
            DestroyEnemies();

            //check if there is any bonus for the cheese
            CheckCheeseBonus();

            //increase number of cheese in player's wallet
            grm.EarnOrSpendCheese(currentCheese);

            //show message panel
            panel.gameObject.SetActive(true);
            panel.ShowResults(currentCheese);

            //update current level in the game record
            grm.ProceedLevel();
        }
    }