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

View File

@ -44,7 +44,6 @@ public class HomeSave
//이벤트
public int mealCount = 999;
public int houseworkCount = 999;
//병합을 위한 메서드
public void MergeWith(HomeSave other)
@ -56,7 +55,6 @@ 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.houseworkCount < 999) houseworkCount = other.houseworkCount;
}
}
@ -66,4 +64,28 @@ public class Save
{
public HomeSave homeSave;
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);
// 백업 시도
if (QuickSaveRaw.Exists(MainSaveFilePath))
{
Debug.LogWarning("메인 세이브로 복구 시도");
return LoadMain();
}
// 메인도 없을 경우 새 세이브 생성
// 새 세이브 생성
Debug.LogError("세이브 전체 손상 → 새 세이브 생성");
return CreateNewSave();
}
@ -184,5 +177,15 @@ public class SaveManager : Singleton<SaveManager>
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;
// health = save.homeSave.health;
// reputation = save.homeSave.reputation;
mealCount = save.homeSave.mealCount;
houseworkCount = save.homeSave.houseworkCount;
//mealCount = save.homeSave.mealCount;
//houseworkCount = save.homeSave.houseworkCount;
Debug.Log("ApplySaveData : " + reputation);
}
@ -105,8 +105,8 @@ public class TestScript : MonoBehaviour,ISaveable
// currentDay = this.currentDay,
// health = this.health,
// reputation = this.reputation,
mealCount = this.mealCount,
houseworkCount = this.houseworkCount
//mealCount = this.mealCount,
//houseworkCount = this.houseworkCount
}
};
}

View File

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

View File

@ -13,8 +13,7 @@ public class DungeonPanelController : MonoBehaviour
private void Start()
{
//int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3
int level = 2;
int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3
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)
{
TimeStat = save.homeSave.time;
HealthStat = save.homeSave.health;
ReputationStat = save.homeSave.reputation;
//mealCount = save.homeSave.mealCount;
//houseworkCount = save.homeSave.houseworkCount;
TimeStat = Mathf.Clamp(save.homeSave.time, 0, _gameConstants.maxTime);
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);
}
}
@ -404,11 +403,10 @@ public class PlayerStats : MonoBehaviour,ISaveable
{
homeSave = new HomeSave
{
time = this.TimeStat,
health = this.HealthStat,
reputation = this.ReputationStat,
//mealCount = this.mealCount,
//houseworkCount = this.houseworkCount
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)
}
};
}

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)
{
stageLevel = save.dungeonSave.stageLevel;
stageLevel = Mathf.Clamp(save.dungeonSave.stageLevel,1,2);
}
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()
{
stageLevel = this.stageLevel,
stageLevel = Mathf.Clamp(this.stageLevel,1,2),
},
homeSave = new HomeSave
{
currentDay = this.currentDay,
currentDay = Mathf.Clamp(this.currentDay,1,maxDays),
}
};
}