From a61e3c4d09b808d00ef94a766a807e27589abf9b Mon Sep 17 00:00:00 2001 From: 99jamin <99jamin56@gmail.com> Date: Wed, 14 May 2025 01:20:54 +0900 Subject: [PATCH] =?UTF-8?q?DEG-165=20=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=20=EB=B0=8F=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/JAY/Scripts/PlayerController.cs | 26 +++++++++------------- Assets/KJM/KJM_Test/Save/Save.cs | 26 ++++++++++++++++++++-- Assets/KJM/KJM_Test/Save/SaveManager.cs | 19 +++++++++------- Assets/KJM/KJM_Test/Save/TestScript.cs | 8 +++---- Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs | 21 ++++++++--------- Assets/KSH/DungeonPanelController.cs | 3 +-- Assets/KSH/PlayerStats.cs | 18 +++++++-------- Assets/KSH/ReDungeon.unity | 4 ++-- Assets/KSH/ReHousing.unity | 4 ++-- Assets/Scripts/Common/GameManager.cs | 8 +++---- 10 files changed, 78 insertions(+), 59 deletions(-) diff --git a/Assets/JAY/Scripts/PlayerController.cs b/Assets/JAY/Scripts/PlayerController.cs index 3af1b575..82a34e05 100644 --- a/Assets/JAY/Scripts/PlayerController.cs +++ b/Assets/JAY/Scripts/PlayerController.cs @@ -86,14 +86,10 @@ public class PlayerController : CharacterBase, IObserver 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 { if (!_isBattle) return; - // 쿨타임 중이면 무시 - if (IsDashOnCooldown) - { - Debug.Log("대시 쿨타임 중"); - return; - } - _currentAction = _attackAction; _currentAction.StartAction(this); } @@ -268,6 +257,13 @@ public class PlayerController : CharacterBase, IObserver { if (!_isBattle) return; + // 쿨타임 중이면 무시 + if (IsDashOnCooldown) + { + Debug.Log("대시 쿨타임 중"); + return; + } + // 만약 공격 중이면 강제로 공격 종료 if (_currentAction == _attackAction && _attackAction.IsActive) { diff --git a/Assets/KJM/KJM_Test/Save/Save.cs b/Assets/KJM/KJM_Test/Save/Save.cs index bebffded..a17dcde5 100644 --- a/Assets/KJM/KJM_Test/Save/Save.cs +++ b/Assets/KJM/KJM_Test/Save/Save.cs @@ -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 + } + }; + } } \ No newline at end of file diff --git a/Assets/KJM/KJM_Test/Save/SaveManager.cs b/Assets/KJM/KJM_Test/Save/SaveManager.cs index e56c402c..bc18a2e3 100644 --- a/Assets/KJM/KJM_Test/Save/SaveManager.cs +++ b/Assets/KJM/KJM_Test/Save/SaveManager.cs @@ -103,14 +103,7 @@ public class SaveManager : Singleton { 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 Debug.Log("자동저장 되었습니다."); } + public void ResetSave() + { + Save fresh = new Save(); + mainSave = fresh.InitSave(); + backupSave = fresh.InitSave(); + SaveMain(); + SaveBackup(); + saveDataController.ApplySaveData(fresh); + } + } diff --git a/Assets/KJM/KJM_Test/Save/TestScript.cs b/Assets/KJM/KJM_Test/Save/TestScript.cs index 108cfffb..0f52da73 100644 --- a/Assets/KJM/KJM_Test/Save/TestScript.cs +++ b/Assets/KJM/KJM_Test/Save/TestScript.cs @@ -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 } }; } diff --git a/Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs b/Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs index baf47f88..3d3c7328 100644 --- a/Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs +++ b/Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs @@ -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); + } } diff --git a/Assets/KSH/DungeonPanelController.cs b/Assets/KSH/DungeonPanelController.cs index 4c645e8e..1d460ba3 100644 --- a/Assets/KSH/DungeonPanelController.cs +++ b/Assets/KSH/DungeonPanelController.cs @@ -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개 diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs index 7fd0e33d..83905c71 100644 --- a/Assets/KSH/PlayerStats.cs +++ b/Assets/KSH/PlayerStats.cs @@ -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) } }; } diff --git a/Assets/KSH/ReDungeon.unity b/Assets/KSH/ReDungeon.unity index 2eff2973..40c41a6d 100644 --- a/Assets/KSH/ReDungeon.unity +++ b/Assets/KSH/ReDungeon.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:908889f0158f1e1ef86cf9a7ddeb607c5fab7b4afebf4418be91f18329a97003 -size 35082 +oid sha256:a1d61074bbb8366ae290687ea6dc34c30266acc9273be837f634593b70b6d8c4 +size 45432 diff --git a/Assets/KSH/ReHousing.unity b/Assets/KSH/ReHousing.unity index 84fd83e2..5515d1ac 100644 --- a/Assets/KSH/ReHousing.unity +++ b/Assets/KSH/ReHousing.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da4d76aa361f46ee82658b01e691ea3b7abf7828e05059c5414274239fc73e71 -size 46388 +oid sha256:b78f0bfed1d3d148a76f0032abb0e6f41226b5c3f91b6ff6b24d30c8eadad8ee +size 49095 diff --git a/Assets/Scripts/Common/GameManager.cs b/Assets/Scripts/Common/GameManager.cs index 85f65d7c..aa7a98c4 100644 --- a/Assets/Scripts/Common/GameManager.cs +++ b/Assets/Scripts/Common/GameManager.cs @@ -114,12 +114,12 @@ public partial class GameManager : Singleton,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,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), } }; }