https://www.youtube.com/watch?v=j48LtUkZRjU&list=PLPV2KyIb3jR53Jce9hP7G5xC4O9AgnOuL
OnClick() 으로 버튼을 눌렀을 때 어떤 작동을 할 것인지 지정해주는 것을 배웠다.
Loading.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Loading : Scene
{
#region INSPECTOR
public TMP_Text text;
#endregion
public override eScene GetSceneType() => eScene.Loading;
[System.NonSerialized]
public bool m_bSceneLoadingFinish = false;
public void Awake()
{
StartCoroutine(_Loading());
StartCoroutine(_Async());
}
string[] s = new string[4] { "Loading", "Loading.", "Loading..", "Loading..." };
int nIndex = 0;
IEnumerator _Loading()
{
while( m_bSceneLoadingFinish == false )
{
text.text = s[nIndex];
++nIndex;
if( nIndex >= s.Length )
{
nIndex = 0;
}
yield return new WaitForSeconds(0.2f);
}
}
IEnumerator _Async()
{
yield return new WaitForSeconds(1.0f);
SceneMng.LoadAsync();
}
}
reset 버튼
남은 지뢰 갯수
지난 시간
등등 구현해보기
ㅇㄹ
'프로그래밍 > C# & Unity' 카테고리의 다른 글
이미지 변경 (0) | 2022.12.09 |
---|