feat: 스테이지 진입 스크립트 추가
This commit is contained in:
@@ -10,6 +10,7 @@ namespace TON
|
|||||||
public List<StageClearData> stageClearDatas { get; private set; }
|
public List<StageClearData> stageClearDatas { get; private set; }
|
||||||
|
|
||||||
private float stageStartTime; // 스테이지 시작 시간
|
private float stageStartTime; // 스테이지 시작 시간
|
||||||
|
private string stageId; // 스테이지 아이디
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
@@ -34,9 +35,10 @@ namespace TON
|
|||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartStage()
|
public void StartStage(string stageId)
|
||||||
{
|
{
|
||||||
stageStartTime = Time.time;
|
stageStartTime = Time.time;
|
||||||
|
this.stageId = stageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetStarCount(float elapsedTime)
|
public int GetStarCount(float elapsedTime)
|
||||||
@@ -49,7 +51,7 @@ namespace TON
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StageClear(string characterId, string stageId)
|
public void StageClear(string characterId)
|
||||||
{
|
{
|
||||||
float clearTime = Time.time - stageStartTime;
|
float clearTime = Time.time - stageStartTime;
|
||||||
int starCount = GetStarCount(clearTime);
|
int starCount = GetStarCount(clearTime);
|
||||||
|
|||||||
51
Gameton-06/Assets/Gameton/Scripts/Scenes/StageScene.cs
Normal file
51
Gameton-06/Assets/Gameton/Scripts/Scenes/StageScene.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Gameton-06/Assets/Gameton/Scripts/Scenes/StageScene.cs.meta
Normal file
11
Gameton-06/Assets/Gameton/Scripts/Scenes/StageScene.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9bd7e55ed83dc3c4882fc6bd4c5c516d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user