Init repository

This commit is contained in:
2024-01-27 08:49:55 +08:00
commit f86a72355b
311 changed files with 121739 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.SceneManagement;
public class AdvLevelMan : MonoBehaviour
{
public Slider loadingBar;
public TMP_Text loadingText;
public void SwitchSceneAdv(string levelName)
{
StartCoroutine(LoadSceneAsync(levelName));
}
IEnumerator LoadSceneAsync(string levelName)
{
Debug.Log($"Loading scene {levelName}");
AsyncOperation op = SceneManager.LoadSceneAsync(levelName);
while (!op.isDone)
{
float progress = Mathf.Clamp01(op.progress / .9f);
//Debug.Log(op.progress);
loadingBar.value = progress;
loadingText.text = $"<align=center>{(progress * 100f).ToString("0.00")}%";
if ((progress * 100f) >= 98)
loadingText.text = "Doing stuff...";
yield return null;
}
}
}