Exemplo n.º 1
0
    void OnItemPurchase(int index)
    {
        Character       character = characterDB.GetCharacter(index);
        CharacterItemUI uiItem    = GetItemUI(index);

        if (GameDataManager.CanSpendWater(character.price))
        {
            //proceed with purchase operation
            GameDataManager.SpendWater(character.price);

            //Update Coin UI text
            GameSharedUI.Instance.UpdateWaterUIText();

            Instantiate(character.fish, new Vector3(0, 60, 0), transform.rotation);
        }
        else
        {
            Debug.Log("Not enough water");
        }
    }