Compare commits

..

No commits in common. "bb480fa452cef218fcef5fcd3a136b980979c37c" and "77c798f9ad89c8bed1f985b583445f179d413cb2" have entirely different histories.

19 changed files with 55 additions and 223 deletions

View File

@ -35,7 +35,7 @@ public class PlayerActionAttack : IPlayerAction {
comboQueued = true; comboQueued = true;
} }
if (comboTimer >= comboDuration-player.attackSpeedLevel) { if (comboTimer >= comboDuration) {
ProceedComboOrEnd(); ProceedComboOrEnd();
} }
} }

View File

@ -30,12 +30,6 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
private IPlayerAction _currentAction; private IPlayerAction _currentAction;
public IPlayerAction CurrentAction => _currentAction; public IPlayerAction CurrentAction => _currentAction;
// 강화 관련
private float attackPowerLevel;
private float moveSpeedLevel;
private float dashCoolLevel;
public float attackSpeedLevel;
// 상태 관련 // 상태 관련
private PlayerStateIdle _playerStateIdle; private PlayerStateIdle _playerStateIdle;
private PlayerStateMove _playerStateMove; private PlayerStateMove _playerStateMove;
@ -43,12 +37,6 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
private PlayerStateHit _playerStateHit; private PlayerStateHit _playerStateHit;
private PlayerStateDead _playerStateDead; private PlayerStateDead _playerStateDead;
//대시 쿨타임 관련
[SerializeField] private float dashCooldownDuration = 1.5f;
private float dashCooldownTimer = 0f;
public bool IsDashOnCooldown => dashCooldownTimer > 0f;
public float DashCooldownRatio => dashCooldownTimer / dashCooldownDuration;
// 행동 관련 // 행동 관련
private PlayerActionAttack _attackAction; private PlayerActionAttack _attackAction;
private PlayerActionDash _actionDash; private PlayerActionDash _actionDash;
@ -84,16 +72,6 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
hitEffectController = GetComponentInChildren<PlayerHitEffectController>(); hitEffectController = GetComponentInChildren<PlayerHitEffectController>();
PlayerInit(); PlayerInit();
//강화 수치 적용
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;
dashCooldownDuration -= dashCoolLevel;
} }
private void Update() private void Update()
@ -103,10 +81,6 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
_playerStates[CurrentState].Update(); _playerStates[CurrentState].Update();
} }
//대시 쿨타임 진행
if (dashCooldownTimer > 0f)
dashCooldownTimer -= Time.deltaTime;
// Hit 상태거나 게임 끝났을 땐 땐 입력 무시 // Hit 상태거나 게임 끝났을 땐 땐 입력 무시
if (CurrentState == PlayerState.Hit || CurrentState == PlayerState.Dead || CurrentState == PlayerState.Win) if (CurrentState == PlayerState.Hit || CurrentState == PlayerState.Dead || CurrentState == PlayerState.Win)
return; return;
@ -257,13 +231,6 @@ 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)
{ {
@ -277,9 +244,6 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
_currentAction = _actionDash; _currentAction = _actionDash;
_actionDash.StartAction(this); _actionDash.StartAction(this);
// 쿨타임 시작
dashCooldownTimer = dashCooldownDuration;
} }
public void OnActionEnded(IPlayerAction action) public void OnActionEnded(IPlayerAction action)

BIN
Assets/KJM/KJM.unity (Stored with Git LFS)

Binary file not shown.

View File

@ -44,6 +44,7 @@ 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)
@ -55,6 +56,7 @@ 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;
} }
} }
@ -64,28 +66,4 @@ 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,7 +103,14 @@ 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();
} }
@ -112,10 +119,7 @@ public class SaveManager : Singleton<SaveManager>
//더미 세이브 파일 생성 //더미 세이브 파일 생성
private Save CreateNewSave() private Save CreateNewSave()
{ {
Save fresh = new Save(); var fresh = saveDataController.GetSaveData();
mainSave = fresh.InitSave();
backupSave = fresh.InitSave();
SaveMain(); SaveMain();
SaveBackup(); SaveBackup();
return fresh; return fresh;
@ -180,15 +184,5 @@ 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

@ -38,13 +38,13 @@ public class TestScript : MonoBehaviour,ISaveable
// attackSpeedLevel = intValue; // attackSpeedLevel = intValue;
// heartLevel = intValue; // heartLevel = intValue;
// moveSpeedLevel = intValue; // moveSpeedLevel = intValue;
//stageLevel = intValue; stageLevel = intValue;
// time = floatValue; time = floatValue;
// currentDay = intValue; currentDay = intValue;
// health = floatValue; health = floatValue;
// reputation = floatValue; reputation = floatValue;
mealCount = intValue; mealCount = intValue;
houseworkCount = intValue; houseworkCount = intValue;
@ -64,17 +64,17 @@ public class TestScript : MonoBehaviour,ISaveable
// heartLevel = save.dungeonSave.heartLevel; // heartLevel = save.dungeonSave.heartLevel;
// moveSpeedLevel = save.dungeonSave.moveSpeedLevel; // moveSpeedLevel = save.dungeonSave.moveSpeedLevel;
// dashCoolDownLevel = save.dungeonSave.dashCoolDownLevel; // dashCoolDownLevel = save.dungeonSave.dashCoolDownLevel;
//stageLevel = save.dungeonSave.stageLevel; stageLevel = save.dungeonSave.stageLevel;
} }
if (save?.homeSave != null) if (save?.homeSave != null)
{ {
// time = save.homeSave.time; time = save.homeSave.time;
// 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);
} }
@ -95,18 +95,18 @@ public class TestScript : MonoBehaviour,ISaveable
// heartLevel = this.heartLevel, // heartLevel = this.heartLevel,
// moveSpeedLevel = this.moveSpeedLevel, // moveSpeedLevel = this.moveSpeedLevel,
// dashCoolDownLevel = this.dashCoolDownLevel, // dashCoolDownLevel = this.dashCoolDownLevel,
//stageLevel = this.stageLevel, stageLevel = this.stageLevel,
}, },
homeSave = new HomeSave homeSave = new HomeSave
{ {
// time = this.time, time = this.time,
// 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
} }
}; };
} }

Binary file not shown.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 322b2c3b468b7714ea61240f9ca7952b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 903a43d31237e6d4cb31a9ad566f4481
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -18,6 +18,7 @@ public enum StatType
public class UpgradeManager : Singleton<UpgradeManager> public class UpgradeManager : Singleton<UpgradeManager>
{ {
//캔버스 프리팹 사용..?
Canvas canvas; Canvas canvas;
public GameObject backgroundPanel; public GameObject backgroundPanel;
@ -156,18 +157,6 @@ public class UpgradeManager : Singleton<UpgradeManager>
//배경 패널 비활성화 //배경 패널 비활성화
StartCoroutine(CoFade(backgroundRectTransform.gameObject, 0.7f,0f,0.2f)); StartCoroutine(CoFade(backgroundRectTransform.gameObject, 0.7f,0f,0.2f));
if (SceneManager.GetActiveScene().name == "ReDungeon")
{
StartCoroutine(DelayedSceneChange()); // n초 대기 후 전환
}
}
//씬 전환 대기 코루틴
private IEnumerator DelayedSceneChange()
{
yield return new WaitForSeconds(2f);
GameManager.Instance.ChangeToHomeScene();
} }
@ -243,8 +232,7 @@ public class UpgradeManager : Singleton<UpgradeManager>
protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode) protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{ {
if(canvas == null)
canvas = FindObjectOfType<Canvas>();
} }
} }

View File

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

View File

@ -114,6 +114,8 @@ public class DungeonLogic : MonoBehaviour
// TODO: 강화 시스템으로 넘어가고 일상 맵으로 이동 // TODO: 강화 시스템으로 넘어가고 일상 맵으로 이동
GameManager.Instance.PanelManager.GetPanel("ClearPanelBG"); GameManager.Instance.PanelManager.GetPanel("ClearPanelBG");
StartCoroutine(DelayedSceneChange()); // 5초 대기 후 전환
} }
} }

View File

@ -9,24 +9,6 @@ public class DungeonPanelController : MonoBehaviour
[SerializeField] private Slider _bossHealthBar; // 0~1 value [SerializeField] private Slider _bossHealthBar; // 0~1 value
[SerializeField] private Image[] _playerHealthImages; // color 값 white / black 로 조정 [SerializeField] private Image[] _playerHealthImages; // color 값 white / black 로 조정
private int _countHealth = 0; private int _countHealth = 0;
private int visibleHeartCount = 3; // 강화 레벨로 설정됨
private void Start()
{
int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3
visibleHeartCount = 3 + (level - 1); // level 1=3개, 2=4개, 3=5개
for (int i = 0; i < _playerHealthImages.Length; i++)
{
var color = _playerHealthImages[i].color;
color.a = (i < visibleHeartCount) ? 1f : 0f;
color = (i < visibleHeartCount) ? Color.white : new Color(1,1,1,0);
_playerHealthImages[i].color = color;
}
_countHealth = 0;
}
public void SetBossHealthBar(float hp) // hp: 0~300 public void SetBossHealthBar(float hp) // hp: 0~300
{ {
@ -39,11 +21,11 @@ public class DungeonPanelController : MonoBehaviour
{ {
StartCoroutine(WaitForOneSecond()); StartCoroutine(WaitForOneSecond());
// out of index error 방지 // out of index error 방지
if (_countHealth >= visibleHeartCount) return false; if (_countHealth > _playerHealthImages.Length - 1) return false;
_playerHealthImages[_countHealth].color = Color.black; _playerHealthImages[_countHealth].color = Color.black;
_countHealth++; _countHealth++;
return _countHealth < visibleHeartCount; return _countHealth <= _playerHealthImages.Length - 1;
} }
IEnumerator WaitForOneSecond() IEnumerator WaitForOneSecond()

View File

@ -5,7 +5,7 @@ using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
public class PlayerStats : MonoBehaviour,ISaveable public class PlayerStats : MonoBehaviour
{ {
public class StatsChangeData // 변경된 스탯 데이터 public class StatsChangeData // 변경된 스탯 데이터
{ {
@ -385,29 +385,4 @@ public class PlayerStats : MonoBehaviour,ISaveable
} }
#endregion #endregion
public void ApplySaveData(Save save)
{
if (save?.homeSave != null)
{
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);
}
}
public Save ExtractSaveData()
{
return new Save
{
homeSave = new HomeSave
{
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

@ -61,6 +61,5 @@ public class ClearPanelController : PanelController, IPointerClickHandler
{ {
onCompleted?.Invoke(); onCompleted?.Invoke();
Hide(); Hide();
UpgradeManager.Instance.StartUpgrade();
} }
} }

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
public partial class GameManager : Singleton<GameManager>,ISaveable public partial class GameManager : Singleton<GameManager>
{ {
// 게임 진행 상태 // 게임 진행 상태
private int currentDay = 1; // 날짜 private int currentDay = 1; // 날짜
@ -109,33 +109,4 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
{ {
// TODO: 게임 종료 시 로직 추가 // TODO: 게임 종료 시 로직 추가
} }
public void ApplySaveData(Save save)
{
if (save?.dungeonSave != null)
{
stageLevel = Mathf.Clamp(save.dungeonSave.stageLevel,1,2);
}
if (save?.homeSave != null)
{
currentDay = Mathf.Clamp(save.homeSave.currentDay,1,maxDays);
}
}
public Save ExtractSaveData()
{
return new Save
{
dungeonSave = new DungeonSave()
{
stageLevel = Mathf.Clamp(this.stageLevel,1,2),
},
homeSave = new HomeSave
{
currentDay = Mathf.Clamp(this.currentDay,1,maxDays),
}
};
}
} }