Ejemplo n.º 1
0
    public void itemSelected()
    {
        string indexStr = EventSystem.current.currentSelectedGameObject.name;
        int    index    = int.Parse(indexStr);

        int price = int.Parse(EventSystem.current.currentSelectedGameObject.GetComponentInChildren <TextMeshProUGUI>().text);

        if ((PlayerCurrency.wealth - price) >= 0)
        {
            // Buying a Gun
            if (index != 10)
            {
                PlayerCurrency playerCurrency = player.GetComponent <PlayerCurrency>();
                playerCurrency.UpdateCurrency(PlayerCurrency.wealth - price);
                PlayerInit.gunsFound[index] = true;
                // Buying Health Upgrade
            }
            else
            {
                playerHealth.BuyHP();
            }
        }
    }