DEG-165 [Fix] 이전 브랜치 병합 요소 적용

This commit is contained in:
99jamin 2025-05-13 22:41:47 +09:00
parent 77c798f9ad
commit 4a1404e212
14 changed files with 172 additions and 26 deletions

View File

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

View File

@ -30,6 +30,12 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
private IPlayerAction _currentAction;
public IPlayerAction CurrentAction => _currentAction;
// 강화 관련
private float attackPowerLevel;
private float moveSpeedLevel;
private float dashCoolLevel;
public float attackSpeedLevel;
// 상태 관련
private PlayerStateIdle _playerStateIdle;
private PlayerStateMove _playerStateMove;
@ -37,6 +43,12 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
private PlayerStateHit _playerStateHit;
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 PlayerActionDash _actionDash;
@ -72,6 +84,20 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
hitEffectController = GetComponentInChildren<PlayerHitEffectController>();
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;
attackPower *= attackPowerLevel;
moveSpeed *= moveSpeedLevel;
dashCooldownDuration -= dashCoolLevel;
}
private void Update()
@ -81,6 +107,10 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
_playerStates[CurrentState].Update();
}
//대시 쿨타임 진행
if (dashCooldownTimer > 0f)
dashCooldownTimer -= Time.deltaTime;
// Hit 상태거나 게임 끝났을 땐 땐 입력 무시
if (CurrentState == PlayerState.Hit || CurrentState == PlayerState.Dead || CurrentState == PlayerState.Win)
return;
@ -223,6 +253,13 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
{
if (!_isBattle) return;
// 쿨타임 중이면 무시
if (IsDashOnCooldown)
{
Debug.Log("대시 쿨타임 중");
return;
}
_currentAction = _attackAction;
_currentAction.StartAction(this);
}
@ -244,6 +281,9 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
_currentAction = _actionDash;
_actionDash.StartAction(this);
// 쿨타임 시작
dashCooldownTimer = dashCooldownDuration;
}
public void OnActionEnded(IPlayerAction action)

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

Binary file not shown.

View File

@ -38,13 +38,13 @@ public class TestScript : MonoBehaviour,ISaveable
// attackSpeedLevel = intValue;
// heartLevel = intValue;
// moveSpeedLevel = intValue;
stageLevel = intValue;
//stageLevel = intValue;
time = floatValue;
currentDay = intValue;
health = floatValue;
reputation = floatValue;
// time = floatValue;
// currentDay = intValue;
// health = floatValue;
// reputation = floatValue;
mealCount = intValue;
houseworkCount = intValue;
@ -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
}

BIN
Assets/KJM/KJM_Test/Upgrade/Prefabs/SaveManager.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

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

BIN
Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeManager.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

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

View File

@ -18,7 +18,6 @@ public enum StatType
public class UpgradeManager : Singleton<UpgradeManager>
{
//캔버스 프리팹 사용..?
Canvas canvas;
public GameObject backgroundPanel;
@ -157,6 +156,18 @@ public class UpgradeManager : Singleton<UpgradeManager>
//배경 패널 비활성화
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();
}
@ -232,7 +243,8 @@ public class UpgradeManager : Singleton<UpgradeManager>
protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if(canvas == null)
canvas = FindObjectOfType<Canvas>();
}
}

View File

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

View File

@ -9,6 +9,25 @@ public class DungeonPanelController : MonoBehaviour
[SerializeField] private Slider _bossHealthBar; // 0~1 value
[SerializeField] private Image[] _playerHealthImages; // color 값 white / black 로 조정
private int _countHealth = 0;
private int visibleHeartCount = 3; // 강화 레벨로 설정됨
private void Start()
{
//int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3
int level = 2;
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
{
@ -21,11 +40,11 @@ public class DungeonPanelController : MonoBehaviour
{
StartCoroutine(WaitForOneSecond());
// out of index error 방지
if (_countHealth > _playerHealthImages.Length - 1) return false;
if (_countHealth >= visibleHeartCount) return false;
_playerHealthImages[_countHealth].color = Color.black;
_countHealth++;
return _countHealth <= _playerHealthImages.Length - 1;
return _countHealth < visibleHeartCount;
}
IEnumerator WaitForOneSecond()

View File

@ -5,7 +5,7 @@ using UnityEngine;
using UnityEngine.SceneManagement;
using Random = UnityEngine.Random;
public class PlayerStats : MonoBehaviour
public class PlayerStats : MonoBehaviour,ISaveable
{
public class StatsChangeData // 변경된 스탯 데이터
{
@ -385,4 +385,31 @@ public class PlayerStats : MonoBehaviour
}
#endregion
public void ApplySaveData(Save save)
{
if (save?.homeSave != null)
{
TimeStat = save.homeSave.time;
HealthStat = save.homeSave.health;
ReputationStat = save.homeSave.reputation;
//mealCount = save.homeSave.mealCount;
//houseworkCount = save.homeSave.houseworkCount;
}
}
public Save ExtractSaveData()
{
return new Save
{
homeSave = new HomeSave
{
time = this.TimeStat,
health = this.HealthStat,
reputation = this.ReputationStat,
//mealCount = this.mealCount,
//houseworkCount = this.houseworkCount
}
};
}
}

View File

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

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; // 날짜
@ -109,4 +109,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,
}
};
}
}