DEG-165 예외처리 및 버그 수정

This commit is contained in:
99jamin 2025-05-14 01:20:54 +09:00
parent d8a4e6c28b
commit a61e3c4d09
10 changed files with 78 additions and 59 deletions

View File

@ -86,14 +86,10 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
PlayerInit(); PlayerInit();
//강화 수치 적용 //강화 수치 적용
//attackPowerLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackPower) / 2; attackPowerLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackPower) / 2;
attackPowerLevel = 1.1f; moveSpeedLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.MoveSpeed) / 2;
//moveSpeedLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.MoveSpeed) / 2; dashCoolLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.DashCoolDown)/5;
moveSpeedLevel = 1.1f; attackSpeedLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackSpeed)/10;
//dashCoolLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.DashCoolDown)/5;
dashCoolLevel = 0.2f;
//attackSpeedLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackSpeed)/10;
attackSpeedLevel = 0.1f;
attackPower *= attackPowerLevel; attackPower *= attackPowerLevel;
moveSpeed *= moveSpeedLevel; moveSpeed *= moveSpeedLevel;
@ -253,13 +249,6 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
{ {
if (!_isBattle) return; if (!_isBattle) return;
// 쿨타임 중이면 무시
if (IsDashOnCooldown)
{
Debug.Log("대시 쿨타임 중");
return;
}
_currentAction = _attackAction; _currentAction = _attackAction;
_currentAction.StartAction(this); _currentAction.StartAction(this);
} }
@ -268,6 +257,13 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
{ {
if (!_isBattle) return; if (!_isBattle) return;
// 쿨타임 중이면 무시
if (IsDashOnCooldown)
{
Debug.Log("대시 쿨타임 중");
return;
}
// 만약 공격 중이면 강제로 공격 종료 // 만약 공격 중이면 강제로 공격 종료
if (_currentAction == _attackAction && _attackAction.IsActive) if (_currentAction == _attackAction && _attackAction.IsActive)
{ {

View File

@ -44,7 +44,6 @@ public class HomeSave
//이벤트 //이벤트
public int mealCount = 999; public int mealCount = 999;
public int houseworkCount = 999;
//병합을 위한 메서드 //병합을 위한 메서드
public void MergeWith(HomeSave other) public void MergeWith(HomeSave other)
@ -56,7 +55,6 @@ public class HomeSave
if (other.health < 999) health = other.health; if (other.health < 999) health = other.health;
if (other.reputation < 999) reputation = other.reputation; if (other.reputation < 999) reputation = other.reputation;
if (other.mealCount < 999) mealCount = other.mealCount; if (other.mealCount < 999) mealCount = other.mealCount;
if (other.houseworkCount < 999) houseworkCount = other.houseworkCount;
} }
} }
@ -66,4 +64,28 @@ public class Save
{ {
public HomeSave homeSave; public HomeSave homeSave;
public DungeonSave dungeonSave; public DungeonSave dungeonSave;
public Save InitSave()
{
return new Save
{
homeSave = new HomeSave
{
currentDay = 1,
time = 8.0f,
health = 8.0f,
reputation = 2.0f,
mealCount = 0
},
dungeonSave = new DungeonSave
{
attackPowerLevel = 1,
attackSpeedLevel = 1,
heartLevel = 1,
moveSpeedLevel = 1,
dashCoolDownLevel = 1,
stageLevel = 1
}
};
}
} }

View File

@ -103,14 +103,7 @@ public class SaveManager : Singleton<SaveManager>
{ {
Debug.LogWarning("Backup 세이브 로드 실패: " + e.Message); Debug.LogWarning("Backup 세이브 로드 실패: " + e.Message);
// 백업 시도 // 새 세이브 생성
if (QuickSaveRaw.Exists(MainSaveFilePath))
{
Debug.LogWarning("메인 세이브로 복구 시도");
return LoadMain();
}
// 메인도 없을 경우 새 세이브 생성
Debug.LogError("세이브 전체 손상 → 새 세이브 생성"); Debug.LogError("세이브 전체 손상 → 새 세이브 생성");
return CreateNewSave(); return CreateNewSave();
} }
@ -184,5 +177,15 @@ public class SaveManager : Singleton<SaveManager>
Debug.Log("자동저장 되었습니다."); Debug.Log("자동저장 되었습니다.");
} }
public void ResetSave()
{
Save fresh = new Save();
mainSave = fresh.InitSave();
backupSave = fresh.InitSave();
SaveMain();
SaveBackup();
saveDataController.ApplySaveData(fresh);
}
} }

View File

@ -73,8 +73,8 @@ public class TestScript : MonoBehaviour,ISaveable
// currentDay = save.homeSave.currentDay; // currentDay = save.homeSave.currentDay;
// health = save.homeSave.health; // health = save.homeSave.health;
// reputation = save.homeSave.reputation; // reputation = save.homeSave.reputation;
mealCount = save.homeSave.mealCount; //mealCount = save.homeSave.mealCount;
houseworkCount = save.homeSave.houseworkCount; //houseworkCount = save.homeSave.houseworkCount;
Debug.Log("ApplySaveData : " + reputation); Debug.Log("ApplySaveData : " + reputation);
} }
@ -105,8 +105,8 @@ public class TestScript : MonoBehaviour,ISaveable
// currentDay = this.currentDay, // currentDay = this.currentDay,
// health = this.health, // health = this.health,
// reputation = this.reputation, // reputation = this.reputation,
mealCount = this.mealCount, //mealCount = this.mealCount,
houseworkCount = this.houseworkCount //houseworkCount = this.houseworkCount
} }
}; };
} }

View File

@ -92,11 +92,11 @@ public class UpgradeStat : MonoBehaviour, ISaveable
{ {
dungeonSave = new DungeonSave dungeonSave = new DungeonSave
{ {
attackPowerLevel = levels[StatType.AttackPower], attackPowerLevel = Mathf.Clamp(levels[StatType.AttackPower],1, DEFAULT_MAX),
attackSpeedLevel = levels[StatType.AttackSpeed], attackSpeedLevel = Mathf.Clamp(levels[StatType.AttackSpeed],1, DEFAULT_MAX),
moveSpeedLevel = levels[StatType.MoveSpeed], moveSpeedLevel = Mathf.Clamp(levels[StatType.MoveSpeed],1, DEFAULT_MAX),
dashCoolDownLevel = levels[StatType.DashCoolDown], dashCoolDownLevel = Mathf.Clamp(levels[StatType.DashCoolDown],1, DEFAULT_MAX),
heartLevel = levels[StatType.Heart] heartLevel = Mathf.Clamp(levels[StatType.Heart],1, MAX_HEART)
} }
}; };
} }
@ -109,11 +109,12 @@ public class UpgradeStat : MonoBehaviour, ISaveable
{ {
if (save?.dungeonSave == null) return; if (save?.dungeonSave == null) return;
levels[StatType.AttackPower] = save.dungeonSave.attackPowerLevel; levels[StatType.AttackPower] = Mathf.Clamp(save.dungeonSave.attackPowerLevel,1, DEFAULT_MAX);
levels[StatType.AttackSpeed] = save.dungeonSave.attackSpeedLevel; levels[StatType.AttackSpeed] = Mathf.Clamp(save.dungeonSave.attackSpeedLevel,1, DEFAULT_MAX);
levels[StatType.MoveSpeed] = save.dungeonSave.moveSpeedLevel; levels[StatType.MoveSpeed] = Mathf.Clamp(save.dungeonSave.moveSpeedLevel,1, DEFAULT_MAX);
levels[StatType.DashCoolDown] = save.dungeonSave.dashCoolDownLevel; levels[StatType.DashCoolDown] = Mathf.Clamp(save.dungeonSave.dashCoolDownLevel,1, DEFAULT_MAX);
levels[StatType.Heart] = save.dungeonSave.heartLevel; levels[StatType.Heart] = Mathf.Clamp(save.dungeonSave.heartLevel,1, MAX_HEART);
} }
} }

View File

@ -13,8 +13,7 @@ public class DungeonPanelController : MonoBehaviour
private void Start() private void Start()
{ {
//int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3 int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3
int level = 2;
visibleHeartCount = 3 + (level - 1); // level 1=3개, 2=4개, 3=5개 visibleHeartCount = 3 + (level - 1); // level 1=3개, 2=4개, 3=5개

View File

@ -390,11 +390,10 @@ public class PlayerStats : MonoBehaviour,ISaveable
{ {
if (save?.homeSave != null) if (save?.homeSave != null)
{ {
TimeStat = save.homeSave.time; TimeStat = Mathf.Clamp(save.homeSave.time, 0, _gameConstants.maxTime);
HealthStat = save.homeSave.health; HealthStat = Mathf.Clamp(save.homeSave.health, 0, _gameConstants.maxHealth);
ReputationStat = save.homeSave.reputation; ReputationStat = Mathf.Clamp(save.homeSave.reputation, 0, _gameConstants.maxReputation);
//mealCount = save.homeSave.mealCount; _mealCount = Mathf.Clamp(save.homeSave.mealCount, 0, 2);
//houseworkCount = save.homeSave.houseworkCount;
} }
} }
@ -404,11 +403,10 @@ public class PlayerStats : MonoBehaviour,ISaveable
{ {
homeSave = new HomeSave homeSave = new HomeSave
{ {
time = this.TimeStat, time = Mathf.Clamp(this.TimeStat,0,_gameConstants.maxTime),
health = this.HealthStat, health = Mathf.Clamp(this.HealthStat,0,_gameConstants.maxHealth),
reputation = this.ReputationStat, reputation = Mathf.Clamp(this.ReputationStat,0,_gameConstants.maxReputation),
//mealCount = this.mealCount, mealCount = Mathf.Clamp(this._mealCount,0,2)
//houseworkCount = this.houseworkCount
} }
}; };
} }

BIN
Assets/KSH/ReDungeon.unity (Stored with Git LFS)

Binary file not shown.

BIN
Assets/KSH/ReHousing.unity (Stored with Git LFS)

Binary file not shown.

View File

@ -114,12 +114,12 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
{ {
if (save?.dungeonSave != null) if (save?.dungeonSave != null)
{ {
stageLevel = save.dungeonSave.stageLevel; stageLevel = Mathf.Clamp(save.dungeonSave.stageLevel,1,2);
} }
if (save?.homeSave != null) if (save?.homeSave != null)
{ {
currentDay = save.homeSave.currentDay; currentDay = Mathf.Clamp(save.homeSave.currentDay,1,maxDays);
} }
} }
@ -129,12 +129,12 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
{ {
dungeonSave = new DungeonSave() dungeonSave = new DungeonSave()
{ {
stageLevel = this.stageLevel, stageLevel = Mathf.Clamp(this.stageLevel,1,2),
}, },
homeSave = new HomeSave homeSave = new HomeSave
{ {
currentDay = this.currentDay, currentDay = Mathf.Clamp(this.currentDay,1,maxDays),
} }
}; };
} }