DEG-108 [Fix] 공격 제한
This commit is contained in:
parent
59625fa8ff
commit
d3948bc577
@ -89,7 +89,8 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
}
|
||||
|
||||
// 공격 입력 처리
|
||||
if (Input.GetKeyDown(KeyCode.X) && (_currentAction == null || !_currentAction.IsActive)) {
|
||||
if (Input.GetKeyDown(KeyCode.X) && (_currentAction == null || !_currentAction.IsActive)
|
||||
&& (CurrentState != PlayerState.Win && CurrentState != PlayerState.Dead)) {
|
||||
Debug.Log("X 버튼 Down 됨");
|
||||
StartAttackAction();
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ public class DungeonLogic : MonoBehaviour
|
||||
{
|
||||
if (isFailed || isCompleted) return; // 어느 한 쪽 사망시 더이상 피격 X
|
||||
|
||||
// TODO: 플레이어 피격 효과음
|
||||
|
||||
var result = _dungeonPanelController.SetPlayerHealth();
|
||||
if (!result) // 하트 모두 소모
|
||||
{
|
||||
@ -52,6 +54,8 @@ public class DungeonLogic : MonoBehaviour
|
||||
{
|
||||
if (isFailed || isCompleted) return;
|
||||
|
||||
// TODO: 에너미 피격 효과음
|
||||
|
||||
_dungeonPanelController.SetBossHealthBar(enemy.currentHP);
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,8 @@ public abstract class CharacterBase : MonoBehaviour
|
||||
|
||||
public virtual void TakeDamage(float damage)
|
||||
{
|
||||
if (currentHP <= 0) return;
|
||||
|
||||
float actualDamage = Mathf.Max(0, damage - defensePower);
|
||||
currentHP -= Mathf.RoundToInt(actualDamage);
|
||||
Debug.Log($"{characterName}이 {actualDamage}의 피해를 입었습니다. 현재 체력: {currentHP}");
|
||||
@ -35,6 +37,7 @@ public abstract class CharacterBase : MonoBehaviour
|
||||
if (currentHP <= 0)
|
||||
{
|
||||
Die();
|
||||
return;
|
||||
}
|
||||
|
||||
OnGetHit?.Invoke(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user