From 470d7a2932c8ee1b27ec0ca85850600b770c93b1 Mon Sep 17 00:00:00 2001 From: Jay <96156114+jaydev00a@users.noreply.github.com> Date: Fri, 25 Apr 2025 17:33:03 +0900 Subject: [PATCH] =?UTF-8?q?DEG-111=20[FIX]=20Actio=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=ED=99=94,=20=EA=B4=80=EB=A0=A8=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JAY/Scripts/IPlayerAction/PlayerActionAttack.cs | 10 +++++++--- Assets/JAY/Scripts/IPlayerAction/PlayerActionDash.cs | 1 + Assets/JAY/Scripts/PlayerController.cs | 11 +++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Assets/JAY/Scripts/IPlayerAction/PlayerActionAttack.cs b/Assets/JAY/Scripts/IPlayerAction/PlayerActionAttack.cs index ab824561..225e1cc7 100644 --- a/Assets/JAY/Scripts/IPlayerAction/PlayerActionAttack.cs +++ b/Assets/JAY/Scripts/IPlayerAction/PlayerActionAttack.cs @@ -1,6 +1,8 @@ using UnityEngine; public class PlayerActionAttack : IPlayerAction { + private static readonly int Attack = Animator.StringToHash("Attack"); + private static readonly int ComboStep = Animator.StringToHash("ComboStep"); private PlayerController player; private int comboStep = 1; private bool comboQueued = false; @@ -14,7 +16,7 @@ public class PlayerActionAttack : IPlayerAction { comboStep = 1; comboQueued = false; PlayComboAnimation(comboStep); - player.PlayerAnimator.SetBool("Attack", true); + player.PlayerAnimator.SetBool(Attack, true); } public void UpdateAction() { @@ -24,12 +26,14 @@ public class PlayerActionAttack : IPlayerAction { } public void EndAction() { - player.PlayerAnimator.SetBool("Attack", false); + player.PlayerAnimator.SetBool(Attack, false); IsActive = false; + player.OnActionEnded(this); player = null; } public void EnableCombo() { + if (comboStep > 4) return; // 마지막 공격일 땐 콤보 허용 X canReceiveCombo = true; } @@ -46,7 +50,7 @@ public class PlayerActionAttack : IPlayerAction { } private void PlayComboAnimation(int step) { - player.PlayerAnimator.SetInteger("ComboStep", step); + player.PlayerAnimator.SetInteger(ComboStep, step); // 무기에 콤보 단계 전달 var weapon = player.GetComponentInChildren(); diff --git a/Assets/JAY/Scripts/IPlayerAction/PlayerActionDash.cs b/Assets/JAY/Scripts/IPlayerAction/PlayerActionDash.cs index e8336ea7..a0713ed5 100644 --- a/Assets/JAY/Scripts/IPlayerAction/PlayerActionDash.cs +++ b/Assets/JAY/Scripts/IPlayerAction/PlayerActionDash.cs @@ -51,6 +51,7 @@ public class PlayerActionDash : IPlayerAction public void EndAction() { IsActive = false; + player.OnActionEnded(this); player = null; } } diff --git a/Assets/JAY/Scripts/PlayerController.cs b/Assets/JAY/Scripts/PlayerController.cs index 2c841575..60153284 100644 --- a/Assets/JAY/Scripts/PlayerController.cs +++ b/Assets/JAY/Scripts/PlayerController.cs @@ -167,7 +167,8 @@ public class PlayerController : CharacterBase, IObserver } // Animation Event에서 호출될 메서드 - public void SetAttackComboTrue() { + public void SetAttackComboTrue() + { if (_weaponController.IsAttacking) return; // 이미 공격 중이면 실행 안함 if (_currentAction == _attackAction) { @@ -176,13 +177,19 @@ public class PlayerController : CharacterBase, IObserver } } - public void SetAttackComboFalse() { + public void SetAttackComboFalse() + { if (_currentAction == _attackAction) { _attackAction.DisableCombo(); _weaponController.AttackEnd(); } } + public void OnActionEnded(IPlayerAction action) + { + if (_currentAction == action) _currentAction = null; + } + #endregion #region 대시 관련