DEG-143[Fix] 병합 버그 수정
This commit is contained in:
parent
979d191ca8
commit
90a58c832a
@ -30,6 +30,11 @@ 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;
|
||||||
|
|
||||||
// 상태 관련
|
// 상태 관련
|
||||||
private PlayerStateIdle _playerStateIdle;
|
private PlayerStateIdle _playerStateIdle;
|
||||||
private PlayerStateMove _playerStateMove;
|
private PlayerStateMove _playerStateMove;
|
||||||
@ -50,6 +55,13 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
|||||||
public bool IsBattle => _isBattle;
|
public bool IsBattle => _isBattle;
|
||||||
public Transform DashEffectAnchor => dashEffectAnchor;
|
public Transform DashEffectAnchor => dashEffectAnchor;
|
||||||
|
|
||||||
|
//대시 쿨타임 관련
|
||||||
|
[SerializeField] private float dashCooldownDuration = 1.5f;
|
||||||
|
private float dashCooldownTimer = 0f;
|
||||||
|
public bool IsDashOnCooldown => dashCooldownTimer > 0f;
|
||||||
|
public float DashCooldownRatio => dashCooldownTimer / dashCooldownDuration;
|
||||||
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
if (Joystick == null)
|
if (Joystick == null)
|
||||||
@ -72,6 +84,15 @@ 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)/4;
|
||||||
|
|
||||||
|
attackPower *= attackPowerLevel;
|
||||||
|
moveSpeed *= moveSpeedLevel;
|
||||||
|
dashCooldownDuration -= dashCoolLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
@ -81,6 +102,10 @@ 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;
|
||||||
@ -231,6 +256,13 @@ 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)
|
||||||
{
|
{
|
||||||
@ -244,6 +276,9 @@ 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)
|
||||||
|
@ -5,7 +5,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
public class PlayerStats : MonoBehaviour
|
public class PlayerStats : MonoBehaviour, ISaveable
|
||||||
{
|
{
|
||||||
public class StatsChangeData // 변경된 스탯 데이터
|
public class StatsChangeData // 변경된 스탯 데이터
|
||||||
{
|
{
|
||||||
@ -354,4 +354,31 @@ public class PlayerStats : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user