feat: 스테이지 진입 스크립트 추가

This commit is contained in:
aube.lee
2025-02-13 23:07:59 +09:00
parent d75adaacbf
commit bf2883ce74
3 changed files with 66 additions and 2 deletions

View File

@@ -0,0 +1,51 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.SceneManagement;
namespace TON
{
public class StageScene : SceneBase
{
public override IEnumerator OnStart()
{
// Ingame 씬을 비동기로 로드한다.
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("Ingame", LoadSceneMode.Single);
// 로드가 완료될 때 까지 yield return null 을 하면서 기다린다
while (!asyncLoad.isDone)
{
yield return null;
}
UIManager.Show<IngameUI>(UIList.IngameUI);
UIManager.Show<IngameOptionUI>(UIList.IngameOptionUI);
UIManager.Show<ControllerUI>(UIList.ControllerUI);
// 선택된 캐릭터에 맞는 오브젝트를 생성하거나 적용하는 코드 작성
PlayerSpawner.SpawnPlayerCharacter();
// 진입한 스테이지 아이디를 불러온다
string stageId = PlayerPrefs.GetString("StageId", null);
Assert.IsNotNull(stageId, "StageScene:: 스테이지 진입 실패!");
StageManager.Singleton.StartStage(stageId);
}
public override IEnumerator OnEnd()
{
yield return null;
UIManager.Hide<IngameUI>(UIList.IngameUI);
UIManager.Hide<IngameOptionUI>(UIList.IngameOptionUI);
UIManager.Hide<ControllerUI>(UIList.ControllerUI);
}
void OnEscapeExecute()
{
// TODO : 게임 일시정지 UI 노출 시 수행
// Time.timeScale = 0f;
// UIManager.Show<PausePopupUI>(UIList.PausePopupUI);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9bd7e55ed83dc3c4882fc6bd4c5c516d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: