feat: 게임 스테이지 클리어 관련 베이스 코드 작성
This commit is contained in:
34
Gameton-06/Assets/Gameton/Scripts/GameData/StageClearData.cs
Normal file
34
Gameton-06/Assets/Gameton/Scripts/GameData/StageClearData.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
[System.Serializable]
|
||||
public class StageClearData
|
||||
{
|
||||
// 스테이지 클리어 데이터의 고유 id
|
||||
public string id;
|
||||
// 클리어한 캐릭터 아이디
|
||||
public string characterId;
|
||||
// 클리어한 스테이지 아이디
|
||||
public string stageId;
|
||||
// 클리어에 소요된 시간
|
||||
public int clearTime;
|
||||
// 클리어 시간에 따른 별점
|
||||
public int starRating;
|
||||
// 클리어한 날짜와 시간 정보
|
||||
public string dateTime;
|
||||
|
||||
public StageClearData(string characterId, string stageId, int clearTime, int starRating)
|
||||
{
|
||||
id = $"SC{DateTime.UtcNow:yyyyMMddHHmmss}-{characterId}-{stageId}";
|
||||
this.characterId = characterId;
|
||||
this.stageId = stageId;
|
||||
this.clearTime = clearTime;
|
||||
this.starRating = starRating;
|
||||
dateTime = DateTime.UtcNow.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5104aacb801da7541b35699566b60c27
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Gameton-06/Assets/Gameton/Scripts/GameStage.meta
Normal file
8
Gameton-06/Assets/Gameton/Scripts/GameStage.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e49ed8f442a8e9942852de004d7c393e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
37
Gameton-06/Assets/Gameton/Scripts/GameStage/StageManager.cs
Normal file
37
Gameton-06/Assets/Gameton/Scripts/GameStage/StageManager.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class StageManager : SingletonBase<StageManager>
|
||||
{
|
||||
|
||||
private float stageStartTime; // 스테이지 시작 시간
|
||||
|
||||
public void StartStage()
|
||||
{
|
||||
stageStartTime = Time.time;
|
||||
}
|
||||
|
||||
public int GetStarCount()
|
||||
{
|
||||
float elapsedTime = Time.time - stageStartTime;
|
||||
|
||||
if (elapsedTime <= 180f)
|
||||
return 3;
|
||||
else if (elapsedTime <= 300f)
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void StageClear()
|
||||
{
|
||||
int starCount = GetStarCount();
|
||||
Debug.Log($"스테이지 클리어! 별 개수: {starCount}");
|
||||
// UI 업데이트, 데이터 저장 로직 추가 가능
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba51d02d7e3fec3448ca66e3eed1f921
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user