Firstborn/Assets/Scripts/StatChangeInt.cs
Schaken-Mods 959e80cf72 assets upload
assets upload description.
2023-03-28 12:16:30 -05:00

51 lines
1.4 KiB
C#

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();
}
}
}
}