- 금고 시스템 ( 입금, 출금 )
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEditor.UI;
using UnityEngine;
public class Test : MonoBehaviour
{
[SerializeField] TMP_Text text;
[SerializeField] TMP_InputField inputfield;
int total = 0;
public void Input()
{
if ((total + int.Parse(inputfield.text)) <= 99999) // 특정수 : 99999 이상 안들어가게 함
{
total += int.Parse(inputfield.text);
text.text = total.ToString();
}
}
public void Output()
{
if ( (total - int.Parse(inputfield.text)) >= 0 ) // 0 이하 금지
{
total -= int.Parse(inputfield.text);
text.text = total.ToString();
}
}
}
유니티 구글 로그인 연동하기 (0) | 2024.07.02 |
---|---|
카메라 우선순위, 오버레이, 겹치기 (0) | 2024.07.01 |
슬라이더, HP 만들기, 체력감소, 도트데미지 (0) | 2024.06.28 |
UI, TextMeshPro(한글폰트 보이는 법), 스킬 쿨타임 (0) | 2024.06.28 |
파티클 시스템 (0) | 2024.06.27 |