using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class GameDirector : MonoBehaviour
{
[SerializeField] UIPopupNickname uIPopupNickname;
[SerializeField] UIHome uIHome;
void Start()
{
Init();
StartCoroutine(CoClicker());
}
IEnumerator CoClicker()
{
while (true)
{
if(this.uIHome.gameObject.activeSelf == true)
{
if (Input.GetMouseButtonDown(0))
{
UserData.Instance.UserCurruntExperience += 10;
if (UserData.Instance.UserCurruntExperience >= UserData.Instance.UserMaxExperience)
{
UserData.Instance.UserCurruntExperience = 0;
UserData.Instance.UserMaxExperience += 100;
UserData.Instance.UserLevel++;
}
}
}
yield return null;
}
}
private void Init()
{
UserData.Instance.UserCurruntExperience = 0;
UserData.Instance.UserMaxExperience = 100;
UserData.Instance.UserLevel = 1;
}
}
2. GameDirector.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIHomeMain : MonoBehaviour
{
[SerializeField] private UIHome uIHome;
[SerializeField] private UIPopupNickname uIPopupNickname;
void Start()
{
uIHome.gameObject.SetActive(false);
uIPopupNickname.gameObject.SetActive(true);
uIHome.AddListenerButton(() => {
uIPopupNickname.gameObject.SetActive(true);
uIHome.gameObject.SetActive(false);
});
}
void Update()
{
}
}
3. UIHomeMain.cs
'산대특 > 게임 UIUX프로그래밍' 카테고리의 다른 글
[LearnUGUI] 스킬 버튼 만들기 (+쿨타임) (0) | 2024.02.08 |
---|---|
[LeanUGUI] TabMenu에 DOTween으로 애니메이션 적용하기 (0) | 2024.02.08 |
[LearnUGUI] 팝업을 통한 이름 변경해보기 (0) | 2024.02.07 |
[LearnUGUI] 로딩바 만들기 (0) | 2024.02.07 |
[LearnUGUI] 결과창(PlayResult) 만들기 (0) | 2024.02.06 |