From bb8a9aea3fcfacbb050968e16b1d55541b48ce54 Mon Sep 17 00:00:00 2001 From: 99jamin <99jamin56@gmail.com> Date: Tue, 13 May 2025 01:44:42 +0900 Subject: [PATCH] =?UTF-8?q?DEG-143-=EC=84=B8=EC=9D=B4=EB=B8=8C,=EA=B0=95?= =?UTF-8?q?=ED=99=94=20=EC=9D=BC=EB=B6=80=20=EB=B3=91=ED=95=A9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/JAY/Scripts/PlayerController.cs | 9 ++++++ Assets/KJM/KJM_Test/Save/TestScript.cs | 20 ++++++------ Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs | 1 - Assets/KSH/DungeonLogic.cs | 1 + Assets/KSH/PlayerStats.cs | 25 ++++++++++++++- Assets/Scripts/Common/GameManager.cs | 31 ++++++++++++++++++- 6 files changed, 74 insertions(+), 13 deletions(-) diff --git a/Assets/JAY/Scripts/PlayerController.cs b/Assets/JAY/Scripts/PlayerController.cs index 153d20b3..651f91bc 100644 --- a/Assets/JAY/Scripts/PlayerController.cs +++ b/Assets/JAY/Scripts/PlayerController.cs @@ -24,6 +24,8 @@ public class PlayerController : CharacterBase, IObserver private bool _isBattle; private GameObject weapon; private WeaponController _weaponController; + private float attackUpgradeLevel; + private float moveSpeedUpgradeLevel; private IPlayerState _currentStateClass { get; set; } private IPlayerAction _currentAction; @@ -71,6 +73,13 @@ public class PlayerController : CharacterBase, IObserver hitEffectController = GetComponentInChildren(); PlayerInit(); + + //강화 적용 + attackUpgradeLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackPower)/2; + moveSpeedUpgradeLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.MoveSpeed)/2; + + attackPower *= attackUpgradeLevel; + moveSpeed *= moveSpeedUpgradeLevel; } private void Update() diff --git a/Assets/KJM/KJM_Test/Save/TestScript.cs b/Assets/KJM/KJM_Test/Save/TestScript.cs index 1d863d71..3fc705ff 100644 --- a/Assets/KJM/KJM_Test/Save/TestScript.cs +++ b/Assets/KJM/KJM_Test/Save/TestScript.cs @@ -64,15 +64,15 @@ public class TestScript : MonoBehaviour,ISaveable // heartLevel = save.dungeonSave.heartLevel; // moveSpeedLevel = save.dungeonSave.moveSpeedLevel; // dashCoolDownLevel = save.dungeonSave.dashCoolDownLevel; - stageLevel = save.dungeonSave.stageLevel; + //stageLevel = save.dungeonSave.stageLevel; } if (save?.homeSave != null) { - time = save.homeSave.time; - currentDay = save.homeSave.currentDay; - health = save.homeSave.health; - reputation = save.homeSave.reputation; + //time = save.homeSave.time; + //currentDay = save.homeSave.currentDay; + //health = save.homeSave.health; + //reputation = save.homeSave.reputation; mealCount = save.homeSave.mealCount; houseworkCount = save.homeSave.houseworkCount; @@ -95,16 +95,16 @@ public class TestScript : MonoBehaviour,ISaveable // heartLevel = this.heartLevel, // moveSpeedLevel = this.moveSpeedLevel, // dashCoolDownLevel = this.dashCoolDownLevel, - stageLevel = this.stageLevel, + //stageLevel = this.stageLevel, }, homeSave = new HomeSave { - time = this.time, - currentDay = this.currentDay, - health = this.health, - reputation = this.reputation, + //time = this.time, + //currentDay = this.currentDay, + //health = this.health, + //reputation = this.reputation, mealCount = this.mealCount, houseworkCount = this.houseworkCount } diff --git a/Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs b/Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs index f7bf555e..a03e6510 100644 --- a/Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs +++ b/Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs @@ -18,7 +18,6 @@ public enum StatType public class UpgradeManager : Singleton { - //캔버스 프리팹 사용..? Canvas canvas; public GameObject backgroundPanel; diff --git a/Assets/KSH/DungeonLogic.cs b/Assets/KSH/DungeonLogic.cs index 1bc28af7..2bdb84ec 100644 --- a/Assets/KSH/DungeonLogic.cs +++ b/Assets/KSH/DungeonLogic.cs @@ -113,6 +113,7 @@ public class DungeonLogic : MonoBehaviour _player.SetState(PlayerState.Win); // TODO: 강화 시스템으로 넘어가고 일상 맵으로 이동 + UpgradeManager.Instance.StartUpgrade(); //강화 시스템 호출 GameManager.Instance.PanelManager.GetPanel("ClearPanelBG"); StartCoroutine(DelayedSceneChange()); // 5초 대기 후 전환 diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs index da3d4a9d..d32ad5a6 100644 --- a/Assets/KSH/PlayerStats.cs +++ b/Assets/KSH/PlayerStats.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UnityEngine; using Random = UnityEngine.Random; -public class PlayerStats : MonoBehaviour +public class PlayerStats : MonoBehaviour, ISaveable { public class StatsChangeData // 변경된 스탯 데이터 { @@ -225,4 +225,27 @@ public class PlayerStats : MonoBehaviour ReputationStat = _gameConstants.maxReputation; } } + + public void ApplySaveData(Save save) + { + if (save?.homeSave != null) + { + TimeStat = save.homeSave.time; + HealthStat = save.homeSave.health; + ReputationStat = save.homeSave.reputation; + } + } + + public Save ExtractSaveData() + { + return new Save + { + homeSave = new HomeSave + { + time = this.TimeStat, + health = this.HealthStat, + reputation = this.ReputationStat, + } + }; + } } diff --git a/Assets/Scripts/Common/GameManager.cs b/Assets/Scripts/Common/GameManager.cs index 42b1b1a2..ac701fa0 100644 --- a/Assets/Scripts/Common/GameManager.cs +++ b/Assets/Scripts/Common/GameManager.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; -public partial class GameManager : Singleton +public partial class GameManager : Singleton, ISaveable { // 게임 진행 상태 private int currentDay = 1; // 날짜 @@ -105,4 +105,33 @@ public partial class GameManager : Singleton { // TODO: 게임 종료 시 로직 추가 } + + public void ApplySaveData(Save save) + { + if (save?.dungeonSave != null) + { + stageLevel = save.dungeonSave.stageLevel; + } + + if (save?.homeSave != null) + { + currentDay = save.homeSave.currentDay; + } + } + + public Save ExtractSaveData() + { + return new Save + { + dungeonSave = new DungeonSave() + { + stageLevel = this.stageLevel, + }, + + homeSave = new HomeSave + { + currentDay = this.currentDay, + } + }; + } }