Example #1
0
    private void PromptBuy(string itemToBuy)
    {
        _itemToBuyCost = 0;
        _itemToBuy     = "";
        _itemToBuy     = itemToBuy;
        ui_WannaBuyCanvas.SetActive(true);
        _itemToBuyCost = InventoryManager.GetItemCost(itemToBuy);
        if (_itemToBuyCost > PongoCoinManager.GetBalance())
        {
            text_WannaBuy.text = $"You Can't Afford This Item?";
            button_OKBuy.gameObject.SetActive(false);
        }
        else
        {
            text_WannaBuy.text = $"Do You Want To Buy This Item For {_itemToBuyCost} PongoCoins?";
            button_OKBuy.gameObject.SetActive(true);
        }


        // disable buttons while on confirmation form
        Button[] buttons = projectileButtons.transform.GetComponentsInChildren <Button>();
        foreach (Button b in buttons)
        {
            b.enabled = false;
        }
    }
 public void SetLevelValueText()
 {
     levelCoinValue1.text  = PongoCoinManager.PongoCoinsForScene("Level01").ToString();
     levelCoinValue2.text  = PongoCoinManager.PongoCoinsForScene("Level02").ToString();
     levelCoinValue3.text  = PongoCoinManager.PongoCoinsForScene("Level03").ToString();
     levelCoinValue4.text  = PongoCoinManager.PongoCoinsForScene("Level04").ToString();
     levelCoinValue5.text  = PongoCoinManager.PongoCoinsForScene("Level05").ToString();
     levelCoinValue6.text  = PongoCoinManager.PongoCoinsForScene("Level06").ToString();
     levelCoinValue7.text  = PongoCoinManager.PongoCoinsForScene("Level07").ToString();
     levelCoinValue8.text  = PongoCoinManager.PongoCoinsForScene("Level08").ToString();
     levelCoinValue9.text  = PongoCoinManager.PongoCoinsForScene("Level09").ToString();
     levelCoinValue10.text = PongoCoinManager.PongoCoinsForScene("Level10").ToString();
     levelCoinValue11.text = PongoCoinManager.PongoCoinsForScene("Level11").ToString();
     levelCoinValue12.text = PongoCoinManager.PongoCoinsForScene("Level12").ToString();
     levelCoinValue13.text = PongoCoinManager.PongoCoinsForScene("Level13").ToString();
     levelCoinValue14.text = PongoCoinManager.PongoCoinsForScene("Level14").ToString();
     levelCoinValue15.text = PongoCoinManager.PongoCoinsForScene("Level15").ToString();
     levelCoinValue16.text = PongoCoinManager.PongoCoinsForScene("Level16").ToString();
 }
Example #3
0
    public void OnClickYesBuyPrompt()
    {
        ui_WannaBuyCanvas.SetActive(false);

        // do transaction
        PongoCoinManager.Spend(_itemToBuyCost);
        InventoryManager.AddToInventory(_itemToBuy);

        // update displayed balance
        text_CoinBalance.text = PongoCoinManager.GetBalance().ToString();

        // re-enable buttons after exiting confirmation
        Button[] buttons = projectileButtons.transform.GetComponentsInChildren <Button>();
        foreach (Button b in buttons)
        {
            b.enabled = true;
        }
        // refresh to show the current selection
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
Example #4
0
    private void ClearedLevel()
    {
        PongoCoinManager.Deposit(PongoCoinManager.PongoCoinsForScene(currentScene.name));

        backgroundMusic.Stop();
        _missionComplete = true;
        int currentMaxLevel = PlayerPrefs.GetInt("MaxLevelReached", -1);

        switch (currentScene.name)
        {
        case "Level01": if (currentMaxLevel < 2)
            {
                PlayerPrefs.SetInt("MaxLevelReached", 2);
            }
            ; break;

        case "Level02": if (currentMaxLevel < 3)
            {
                PlayerPrefs.SetInt("MaxLevelReached", 3);
            }
            ; break;

        case "Level03": if (currentMaxLevel < 4)
            {
                PlayerPrefs.SetInt("MaxLevelReached", 4);
            }
            ; break;

        case "Level04": if (currentMaxLevel < 5)
            {
                PlayerPrefs.SetInt("MaxLevelReached", 5);
            }
            ; break;

        case "Level05": if (currentMaxLevel < 6)
            {
                PlayerPrefs.SetInt("MaxLevelReached", 6);
            }
            ; break;

        case "Level06": if (currentMaxLevel < 7)
            {
                PlayerPrefs.SetInt("MaxLevelReached", 7);
            }
            ; break;

        case "Level07": if (currentMaxLevel < 8)
            {
                PlayerPrefs.SetInt("MaxLevelReached", 8);
            }
            ; break;

        case "Level08": if (currentMaxLevel < 9)
            {
                PlayerPrefs.SetInt("MaxLevelReached", 9);
            }
            ; break;
        }
        pelota.GetComponent <Pelota>()?.Die();
        missionCompleteCanvas.SetActive(true);
        // Enable Firework particle Spawners here
        fireWorks?.transform.GetChild(0).gameObject.SetActive(true);
        fireWorks?.transform.GetChild(1).gameObject.SetActive(true);
        // Play Clap sound here
        sm.PlayClappingSound();
    }
Example #5
0
    // Start is called before the first frame update
    void Start()
    {
        // Display players coin balance
        text_CoinBalance.text = PongoCoinManager.GetBalance().ToString();

        _itemToBuyCost    = 0;  // variable used later to know cost of clicked item
        ui_WannaBuyCanvas = GameObject.FindGameObjectWithTag("buy_ui_tag").transform.GetChild(0).gameObject;
        lockImage1        = GameObject.Find("LockImage1");
        checkImage1       = GameObject.Find("CheckImage1");
        lockImage2        = GameObject.Find("LockImage2");
        checkImage2       = GameObject.Find("CheckImage2");
        lockImage3        = GameObject.Find("LockImage3");
        checkImage3       = GameObject.Find("CheckImage3");
        lockImage4        = GameObject.Find("LockImage4");
        checkImage4       = GameObject.Find("CheckImage4");
        lockImage5        = GameObject.Find("LockImage5");
        checkImage5       = GameObject.Find("CheckImage5");
        lockImage6        = GameObject.Find("LockImage6");
        checkImage6       = GameObject.Find("CheckImage6");
        lockImage7        = GameObject.Find("LockImage7");
        checkImage7       = GameObject.Find("CheckImage7");
        lockImage8        = GameObject.Find("LockImage8");
        checkImage8       = GameObject.Find("CheckImage8");



        // hide all the check images first
        checkImage1.SetActive(false);
        checkImage2.SetActive(false);
        checkImage3.SetActive(false);
        checkImage4.SetActive(false);
        checkImage5.SetActive(false);
        checkImage6.SetActive(false);
        checkImage7.SetActive(false);
        checkImage8.SetActive(false);
        // and then show it only on the active projectile
        string chosenProjectile = PlayerPrefs.GetString("ChosenProjectile", "none");

        switch (chosenProjectile)
        {
        case "Ball01": checkImage1.SetActive(true); break;

        case "Ball02": checkImage2.SetActive(true); break;

        case "Ball03": checkImage3.SetActive(true); break;

        case "Ball04": checkImage4.SetActive(true); break;

        case "Football01": checkImage5.SetActive(true); break;

        //case "Triangle01": checkImage6.SetActive(true); break;
        case "Arrow": checkImage6.SetActive(true); break;

        case "Triangle02": checkImage7.SetActive(true); break;

        //case "Triangle03": checkImage8.SetActive(true); break;
        case "Rocket": checkImage8.SetActive(true); break;

        default: checkImage1.SetActive(true); break;
        }


        // Unlock the balls owned by the player
        lockImage1.SetActive(false);
        lockImage2.SetActive(false);
        lockImage3.SetActive(!InventoryManager.DoesPlayerOwnInventoryItem("Ball03"));
        lockImage4.SetActive(!InventoryManager.DoesPlayerOwnInventoryItem("Ball04"));
        lockImage5.SetActive(!InventoryManager.DoesPlayerOwnInventoryItem("Football01"));
        lockImage6.SetActive(!InventoryManager.DoesPlayerOwnInventoryItem("Arrow"));
        lockImage7.SetActive(!InventoryManager.DoesPlayerOwnInventoryItem("Triangle02"));
        lockImage8.SetActive(!InventoryManager.DoesPlayerOwnInventoryItem("Rocket"));



        SetItemCostText();
    }
    // Start is called before the first frame update
    void Start()
    {
        mainMenuMusic = GameObject.FindGameObjectWithTag("main_menu_music_tag")?.GetComponent <AudioSource>();

        button02.SetActive(false);
        button03.SetActive(false);
        button04.SetActive(false);
        button05.SetActive(false);
        button06.SetActive(false);
        button07.SetActive(false);
        button08.SetActive(false);
        button09.SetActive(false);
        button10.SetActive(false);
        button11.SetActive(false);
        button12.SetActive(false);
        button13.SetActive(false);
        button14.SetActive(false);
        button15.SetActive(false);
        button16.SetActive(false);

        //GameObject[] levelButtons = GameObject.FindGameObjectsWithTag("level_button_tag");
        //levelButtons[0].SetActive(true);
        //levelButtons[1].SetActive(false);
        //levelButtons[2].SetActive(false);
        //levelButtons[3].SetActive(false);
        //levelButtons[4].SetActive(false);
        //levelButtons[5].SetActive(false);
        //levelButtons[6].SetActive(false);
        //levelButtons[7].SetActive(false);

        int maxLevel = PlayerPrefs.GetInt("MaxLevelReached", -1);

        switch (maxLevel)
        {
        case -1:
            button01.SetActive(true);     // prob don't need this
            break;

        case 2:
            button02.SetActive(true);
            break;

        case 3:
            button02.SetActive(true);
            button03.SetActive(true);
            break;

        case 4:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            break;

        case 5:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            break;

        case 6:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            break;

        case 7:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            break;

        case 8:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            button08.SetActive(true);
            break;

        case 9:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            button08.SetActive(true);
            //button09.SetActive(true);
            break;

        case 10:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            button08.SetActive(true);
            button09.SetActive(true);
            button10.SetActive(true);
            break;

        case 11:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            button08.SetActive(true);
            button09.SetActive(true);
            button10.SetActive(true);
            button11.SetActive(true);
            break;

        case 12:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            button08.SetActive(true);
            button09.SetActive(true);
            button10.SetActive(true);
            button11.SetActive(true);
            button12.SetActive(true);
            break;

        case 13:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            button08.SetActive(true);
            button09.SetActive(true);
            button10.SetActive(true);
            button11.SetActive(true);
            button12.SetActive(true);
            button13.SetActive(true);
            break;

        case 14:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            button08.SetActive(true);
            button09.SetActive(true);
            button10.SetActive(true);
            button11.SetActive(true);
            button12.SetActive(true);
            button13.SetActive(true);
            button14.SetActive(true);
            break;

        case 15:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            button08.SetActive(true);
            button09.SetActive(true);
            button10.SetActive(true);
            button11.SetActive(true);
            button12.SetActive(true);
            button13.SetActive(true);
            button14.SetActive(true);
            button15.SetActive(true);
            break;

        case 16:
            button02.SetActive(true);
            button03.SetActive(true);
            button04.SetActive(true);
            button05.SetActive(true);
            button06.SetActive(true);
            button07.SetActive(true);
            button08.SetActive(true);
            button09.SetActive(true);
            button10.SetActive(true);
            button11.SetActive(true);
            button12.SetActive(true);
            button13.SetActive(true);
            button14.SetActive(true);
            button15.SetActive(true);
            button16.SetActive(true);
            break;
        }


        SetLevelValueText();
        playerPongoCoinBalanceText.text = PongoCoinManager.GetBalance().ToString();
    }