DEG-111 [FIX] Actio 초기화, 관련 버그 수정
This commit is contained in:
parent
fc8ec74970
commit
470d7a2932
@ -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<WeaponController>();
|
||||
|
@ -51,6 +51,7 @@ public class PlayerActionDash : IPlayerAction
|
||||
public void EndAction()
|
||||
{
|
||||
IsActive = false;
|
||||
player.OnActionEnded(this);
|
||||
player = null;
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,8 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
}
|
||||
|
||||
// Animation Event에서 호출될 메서드
|
||||
public void SetAttackComboTrue() {
|
||||
public void SetAttackComboTrue()
|
||||
{
|
||||
if (_weaponController.IsAttacking) return; // 이미 공격 중이면 실행 안함
|
||||
|
||||
if (_currentAction == _attackAction) {
|
||||
@ -176,13 +177,19 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
}
|
||||
}
|
||||
|
||||
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 대시 관련
|
||||
|
Loading…
x
Reference in New Issue
Block a user