using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class StatChangeInt : MonoBehaviour { [SerializeField] private TextMeshProUGUI RemainingPoints; [SerializeField] private TextMeshProUGUI EditingBox; [SerializeField] private bool Adding; [SerializeField] private GameObject CantChangeBox; [SerializeField] private GameObject ChangeBoxParent; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void ChangeValue() { int i = int.Parse(EditingBox.text); int j = int.Parse(RemainingPoints.text); if (Adding) { if (RemainingPoints.text == "0") { CantChangeBox.SetActive(true); ChangeBoxParent.SetActive(true); } else { i += 1; j -= 1; RemainingPoints.text = j.ToString(); EditingBox.text = i.ToString(); } } else { if (EditingBox.text == "0") { CantChangeBox.SetActive(true); ChangeBoxParent.SetActive(true); } else { i -= 1; j += 1; RemainingPoints.text = j.ToString(); EditingBox.text = i.ToString(); } } } }