DEG-165 [Feat] 세이브 연동, 하트 순서 수정,엔딩 시 세이브 초기화
This commit is contained in:
parent
2bee472f14
commit
81ffd4f7ac
@ -15,6 +15,9 @@ public class DungeonSave
|
||||
// 현재 진행 중인 스테이지
|
||||
public int stageLevel = 0;
|
||||
|
||||
// 스테이지 도전 횟수
|
||||
public int tryStageCount = 999;
|
||||
|
||||
//병합을 위한 메서드
|
||||
public void MergeWith(DungeonSave other)
|
||||
{
|
||||
@ -26,6 +29,7 @@ public class DungeonSave
|
||||
if (other.moveSpeedLevel != 0) moveSpeedLevel = other.moveSpeedLevel;
|
||||
if (other.dashCoolDownLevel != 0) dashCoolDownLevel = other.dashCoolDownLevel;
|
||||
if (other.stageLevel != 0) stageLevel = other.stageLevel;
|
||||
if (other.tryStageCount < 999) tryStageCount = other.tryStageCount;
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,6 +49,16 @@ public class HomeSave
|
||||
//이벤트
|
||||
public int mealCount = 999;
|
||||
|
||||
public bool hasShownBubbleToday = false;
|
||||
public bool hasShownBubbleTodaySet = false;
|
||||
|
||||
public bool hasCheckedAbsenceToday;
|
||||
public bool hasCheckedAbsenceTodaySet = false;
|
||||
|
||||
//튜토리얼 여부
|
||||
public bool hasTutorial;
|
||||
public bool hasTutorialSet;
|
||||
|
||||
//병합을 위한 메서드
|
||||
public void MergeWith(HomeSave other)
|
||||
{
|
||||
@ -55,6 +69,12 @@ public class HomeSave
|
||||
if (other.health < 999) health = other.health;
|
||||
if (other.reputation < 999) reputation = other.reputation;
|
||||
if (other.mealCount < 999) mealCount = other.mealCount;
|
||||
|
||||
if (other.hasShownBubbleTodaySet) hasShownBubbleToday = other.hasShownBubbleToday;
|
||||
|
||||
if (other.hasCheckedAbsenceTodaySet) hasCheckedAbsenceToday = other.hasCheckedAbsenceToday;
|
||||
|
||||
if (other.hasTutorialSet) hasTutorial = other.hasTutorial;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +85,7 @@ public class Save
|
||||
public HomeSave homeSave;
|
||||
public DungeonSave dungeonSave;
|
||||
|
||||
//초기 세팅 반환
|
||||
public Save InitSave()
|
||||
{
|
||||
return new Save
|
||||
@ -75,7 +96,10 @@ public class Save
|
||||
time = 8.0f,
|
||||
health = 8.0f,
|
||||
reputation = 2.0f,
|
||||
mealCount = 0
|
||||
mealCount = 0,
|
||||
hasShownBubbleToday = false,
|
||||
hasCheckedAbsenceToday = false,
|
||||
hasTutorial = false,
|
||||
},
|
||||
dungeonSave = new DungeonSave
|
||||
{
|
||||
@ -84,7 +108,9 @@ public class Save
|
||||
heartLevel = 1,
|
||||
moveSpeedLevel = 1,
|
||||
dashCoolDownLevel = 1,
|
||||
stageLevel = 1
|
||||
stageLevel = 1,
|
||||
tryStageCount = 0
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class DungeonPanelController : MonoBehaviour
|
||||
// out of index error 방지
|
||||
if (_countHealth >= visibleHeartCount) return false;
|
||||
|
||||
_playerHealthImages[_countHealth].color = Color.black;
|
||||
_playerHealthImages[visibleHeartCount-(_countHealth+1)].color = Color.black;
|
||||
_countHealth++;
|
||||
return _countHealth < visibleHeartCount;
|
||||
}
|
||||
|
@ -396,6 +396,8 @@ public class PlayerStats : MonoBehaviour,ISaveable
|
||||
HealthStat = Mathf.Clamp(save.homeSave.health, 0, _gameConstants.maxHealth);
|
||||
ReputationStat = Mathf.Clamp(save.homeSave.reputation, 0, _gameConstants.maxReputation);
|
||||
_mealCount = Mathf.Clamp(save.homeSave.mealCount, 0, 2);
|
||||
_hasCheckedAbsenceToday = save.homeSave.hasCheckedAbsenceToday;
|
||||
_hasShownBubbleToday = save.homeSave.hasShownBubbleToday;
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,7 +410,13 @@ public class PlayerStats : MonoBehaviour,ISaveable
|
||||
time = Mathf.Clamp(this.TimeStat,0,_gameConstants.maxTime),
|
||||
health = Mathf.Clamp(this.HealthStat,0,_gameConstants.maxHealth),
|
||||
reputation = Mathf.Clamp(this.ReputationStat,0,_gameConstants.maxReputation),
|
||||
mealCount = Mathf.Clamp(this._mealCount,0,2)
|
||||
mealCount = Mathf.Clamp(this._mealCount,0,2),
|
||||
|
||||
hasCheckedAbsenceTodaySet = true,
|
||||
hasCheckedAbsenceToday = this._hasCheckedAbsenceToday,
|
||||
|
||||
hasShownBubbleTodaySet = true,
|
||||
hasShownBubbleToday = this._hasShownBubbleToday,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -130,6 +130,7 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
||||
if (save?.dungeonSave != null)
|
||||
{
|
||||
stageLevel = Mathf.Clamp(save.dungeonSave.stageLevel,1,2);
|
||||
tryStageCount = Mathf.Clamp(save.dungeonSave.tryStageCount,0,3);
|
||||
}
|
||||
|
||||
if (save?.homeSave != null)
|
||||
@ -145,6 +146,7 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
||||
dungeonSave = new DungeonSave()
|
||||
{
|
||||
stageLevel = Mathf.Clamp(this.stageLevel,1,2),
|
||||
tryStageCount = Mathf.Clamp(this.tryStageCount,0,3),
|
||||
},
|
||||
|
||||
homeSave = new HomeSave
|
||||
|
@ -23,11 +23,17 @@ public partial class GameManager
|
||||
private void ZeroReputationEnd() // 평판 0 엔딩
|
||||
{
|
||||
StartNPCDialogue(GamePhase.ZeroEnd);
|
||||
|
||||
//세이브 초기화
|
||||
SaveManager.Instance.ResetSave();
|
||||
}
|
||||
|
||||
private void FailEnd() // 같은 스테이지 3회 도전 실패 엔딩
|
||||
{
|
||||
StartNPCDialogue(GamePhase.FailEnd);
|
||||
|
||||
//세이브 초기화
|
||||
SaveManager.Instance.ResetSave();
|
||||
}
|
||||
|
||||
// 회고 엔딩. 7일차에 실행
|
||||
@ -35,5 +41,8 @@ public partial class GameManager
|
||||
{
|
||||
// npc와의 마지막 대화 출력
|
||||
StartNPCDialogue(GamePhase.End);
|
||||
|
||||
//세이브 초기화
|
||||
SaveManager.Instance.ResetSave();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user