DEG-143-세이브,강화 일부 병합.

This commit is contained in:
99jamin 2025-05-13 01:44:42 +09:00
parent bac6ec5f34
commit bb8a9aea3f
6 changed files with 74 additions and 13 deletions

View File

@ -24,6 +24,8 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
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<GameObject>
hitEffectController = GetComponentInChildren<PlayerHitEffectController>();
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()

View File

@ -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
}

View File

@ -18,7 +18,6 @@ public enum StatType
public class UpgradeManager : Singleton<UpgradeManager>
{
//캔버스 프리팹 사용..?
Canvas canvas;
public GameObject backgroundPanel;

View File

@ -113,6 +113,7 @@ public class DungeonLogic : MonoBehaviour
_player.SetState(PlayerState.Win);
// TODO: 강화 시스템으로 넘어가고 일상 맵으로 이동
UpgradeManager.Instance.StartUpgrade(); //강화 시스템 호출
GameManager.Instance.PanelManager.GetPanel("ClearPanelBG");
StartCoroutine(DelayedSceneChange()); // 5초 대기 후 전환

View File

@ -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,
}
};
}
}

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public partial class GameManager : Singleton<GameManager>
public partial class GameManager : Singleton<GameManager>, ISaveable
{
// 게임 진행 상태
private int currentDay = 1; // 날짜
@ -105,4 +105,33 @@ public partial class GameManager : Singleton<GameManager>
{
// 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,
}
};
}
}