using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ResourceManager : MonoBehaviour
{
    // Variables for the resources
    public int scrap;
    public int water;
    public int soap;

    // UI stuff
    [SerializeField] private GameObject textObject;
    private Text resourceText;
    void Start()
    {
        resourceText = textObject.GetComponent<Text>();
    }

    // Update is called once per frame
    void Update()
    {
        string displayedText = $"Scrap: {scrap}\nWater: {water}\nSoap: {soap}";

        resourceText.text = displayedText;
    }

    public int ChangeResourceValue(string type, int amount)
    {
        if (type == "scrap")
        {
            scrap += amount;
        }
        else if (type == "water")
        {
            water += amount;
        }
        else if (type == "soap")
        {
            soap += amount;
        }
        else
        {
            Debug.Log("Something isn't right");
        }
        return amount;
    }
}
