示例#1
0
    void Update()
    {
        chickenCurrency = GameDataManager.instance.GetCaughtChickenCount();
        penguinCurrency = GameDataManager.instance.GetCaughtPenguinCount();

        // update the top left inventory icons
        chickenCurrencyText.text = chickenCurrency.ToString();
        penguinCurrencyText.text = penguinCurrency.ToString();

        // update button
        if (clickedItem == Item.CHICKEN_FEED)
        {
            if (chickenCurrency < CHICKEN_FEED_PRICE_IN_CHICKENCURRENCY)
            {
                // grey out UI
                PayChickenBtn.GetComponent <Button>().interactable = false;
            }

            if (penguinCurrency < CHICKEN_FEED_PRICE_IN_PENGUINCURRENCY)
            {
                // grey out UI
                PayPenguinBtn.GetComponent <Button>().interactable = false;
            }
        }

        if (clickedItem == Item.PENGUIN_FEED)
        {
            if (chickenCurrency < PENGUIN_FEED_PRICE_IN_CHICKENCURRENCY)
            {
                // grey out UI
                PayChickenBtn.GetComponent <Button>().interactable = false;
            }

            if (penguinCurrency < PENGUIN_FEED_PRICE_IN_PENGUINCURRENCY)
            {
                // grey out UI
                PayPenguinBtn.GetComponent <Button>().interactable = false;
            }
        }

        if (clickedItem == Item.BUBBLE_GUN)
        {
            if (chickenCurrency < BUBBLE_GUN_PRICE_IN_CHICKENCURRENCY)
            {
                // grey out UI
                PayChickenBtn.GetComponent <Button>().interactable = false;
            }

            if (penguinCurrency < BUBBLE_GUN_PRICE_IN_PENGUINCURRENCY)
            {
                // grey out UI
                PayPenguinBtn.GetComponent <Button>().interactable = false;
            }
        }

        if (clickedItem == Item.MAGNET)
        {
            if (chickenCurrency < MAGNET_IN_CHICKENCURRENCY)
            {
                // grey out UI
                PayChickenBtn.GetComponent <Button>().interactable = false;
            }

            if (penguinCurrency < MAGNET_IN_PENGUINCURRENCY)
            {
                // grey out UI
                PayPenguinBtn.GetComponent <Button>().interactable = false;
            }
        }
    }
示例#2
0
 void ResetButtonInteractivity()
 {
     PayChickenBtn.GetComponent <Button>().interactable = true;
     PayPenguinBtn.GetComponent <Button>().interactable = true;
 }