DEG-54 [Feat] 엔딩 로직 구현
This commit is contained in:
parent
362733785c
commit
23e411b6e1
@ -83,8 +83,9 @@ public class DungeonLogic : MonoBehaviour
|
|||||||
if (!isCompleted && !isFailed)
|
if (!isCompleted && !isFailed)
|
||||||
{
|
{
|
||||||
Debug.Log("던전 공략 성공~!");
|
Debug.Log("던전 공략 성공~!");
|
||||||
|
GameManager.Instance.ClearStage(); // 스테이지 수 증가
|
||||||
isCompleted = true;
|
isCompleted = true;
|
||||||
OnDungeonSuccess?.Invoke();
|
// OnDungeonSuccess?.Invoke();
|
||||||
|
|
||||||
_dungeonPanelController.SetBossHealthBar(0.0f); // 보스 체력 0 재설정
|
_dungeonPanelController.SetBossHealthBar(0.0f); // 보스 체력 0 재설정
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ public class DungeonLogic : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Debug.Log("던전 공략 실패~!");
|
Debug.Log("던전 공략 실패~!");
|
||||||
isFailed = true;
|
isFailed = true;
|
||||||
OnDungeonFailure?.Invoke();
|
// OnDungeonFailure?.Invoke();
|
||||||
|
|
||||||
_player.SetState(PlayerState.Dead);
|
_player.SetState(PlayerState.Dead);
|
||||||
|
|
||||||
|
@ -40,4 +40,7 @@ public class GameConstants
|
|||||||
|
|
||||||
// 날짜 한계 값
|
// 날짜 한계 값
|
||||||
public static int maxDays = 7;
|
public static int maxDays = 7;
|
||||||
|
|
||||||
|
// 스테이지 한계 값
|
||||||
|
public static int maxStage = 3; // 기본 값 1 + 스테이지 2가지
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,13 @@ public partial class GameManager : Singleton<GameManager>
|
|||||||
private Canvas _canvas;
|
private Canvas _canvas;
|
||||||
|
|
||||||
// 게임 진행 상태
|
// 게임 진행 상태
|
||||||
private int currentDay = 1;
|
private int currentDay = 1; // 날짜
|
||||||
public int CurrentDay => currentDay;
|
public int CurrentDay => currentDay;
|
||||||
private int maxDays = GameConstants.maxDays;
|
private int maxDays = GameConstants.maxDays;
|
||||||
|
|
||||||
|
private int stageLevel = 1; // 스테이지 정보
|
||||||
|
public int StageLevel => stageLevel;
|
||||||
|
|
||||||
// 날짜 변경 이벤트, 추후에 UI 상의 날짜를 변경할 때 사용
|
// 날짜 변경 이벤트, 추후에 UI 상의 날짜를 변경할 때 사용
|
||||||
public event Action<int> OnDayChanged;
|
public event Action<int> OnDayChanged;
|
||||||
|
|
||||||
@ -44,19 +47,12 @@ public partial class GameManager : Singleton<GameManager>
|
|||||||
OnDayChanged?.Invoke(currentDay);
|
OnDayChanged?.Invoke(currentDay);
|
||||||
|
|
||||||
// 최대 일수 도달 체크
|
// 최대 일수 도달 체크
|
||||||
if (currentDay > maxDays)
|
if (currentDay > maxDays) // 8일차에 검사
|
||||||
{
|
{
|
||||||
TriggerTimeEnding();
|
TriggerTimeEnding();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 엔딩 트리거
|
|
||||||
private void TriggerTimeEnding()
|
|
||||||
{
|
|
||||||
// TODO: 엔딩 처리 로직
|
|
||||||
Debug.Log("7일이 지나 게임이 종료됩니다.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeToGameScene()
|
public void ChangeToGameScene()
|
||||||
{
|
{
|
||||||
SceneManager.LoadScene("Game"); // 던전 Scene
|
SceneManager.LoadScene("Game"); // 던전 Scene
|
||||||
|
58
Assets/Scripts/Common/GameUtility/EndingLogic.cs
Normal file
58
Assets/Scripts/Common/GameUtility/EndingLogic.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
// 엔딩 타입 정의
|
||||||
|
public enum EndingType
|
||||||
|
{
|
||||||
|
Normal, // 던전 공략 O
|
||||||
|
Bad, // 던전 공략 X
|
||||||
|
Happy // 던전 공략 O, 평판 기본 스탯 값 * 1.5 이상
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class GameManager : Singleton<GameManager>
|
||||||
|
{
|
||||||
|
private float happyEndReputation = 3.0f;
|
||||||
|
|
||||||
|
public void ClearStage()
|
||||||
|
{
|
||||||
|
Debug.Log($"스테이지 레벨 {stageLevel}을 클리어 하셨습니다!");
|
||||||
|
stageLevel++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 엔딩 관련 메서드. 7일차에 실행
|
||||||
|
private void TriggerTimeEnding()
|
||||||
|
{
|
||||||
|
// 플레이어 상태에 따라 엔딩 판별
|
||||||
|
EndingType endingType = DetermineEnding();
|
||||||
|
|
||||||
|
// 엔딩 타입에 따라 다른 씬이나 UI 표시
|
||||||
|
switch (endingType)
|
||||||
|
{
|
||||||
|
case EndingType.Normal:
|
||||||
|
Debug.Log("던전 공략 성공");
|
||||||
|
// TODO: 엔딩 관련 패널 띄우기
|
||||||
|
break;
|
||||||
|
case EndingType.Bad:
|
||||||
|
Debug.Log("던전 공략 실패");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case EndingType.Happy:
|
||||||
|
Debug.Log("던전 공략 성공과 훌륭한 평판 작");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 던전 스테이지와 평판 수치로 엔딩 판별
|
||||||
|
private EndingType DetermineEnding()
|
||||||
|
{
|
||||||
|
if (stageLevel < GameConstants.maxStage) // 현재 스테이지 1 혹은 2
|
||||||
|
return EndingType.Bad;
|
||||||
|
|
||||||
|
if (playerStats.ReputationStat >= happyEndReputation) // 평판이 일정 수치 이상
|
||||||
|
return EndingType.Happy;
|
||||||
|
|
||||||
|
return EndingType.Normal;
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Common/GameUtility/EndingLogic.cs.meta
Normal file
11
Assets/Scripts/Common/GameUtility/EndingLogic.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e0967fea1a1fa5048b551b72f9d3bc16
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
x
Reference in New Issue
Block a user