공격 스테이트 추가 + 플레이어가 우측으로 이동 하다 멈추면 왼쪽을 바라보는 문제 수정
This commit is contained in:
@@ -17,6 +17,9 @@ public class PlayerMove : MonoBehaviour
|
||||
|
||||
private StateMachine _stateMachine;
|
||||
|
||||
// 공격 콜라이더
|
||||
public Collider2D attackCollider;
|
||||
|
||||
// 사용하는 컴포넌트들 초기화
|
||||
void Awake()
|
||||
{
|
||||
@@ -35,6 +38,9 @@ public class PlayerMove : MonoBehaviour
|
||||
}
|
||||
|
||||
_stateMachine = new StateMachine(State.IDLE, this);
|
||||
|
||||
// 공격 콜라이더 참조
|
||||
attackCollider = GetComponentInChildren<Collider2D>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -76,4 +82,21 @@ public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
// OffDamaged 로직은 DamagedState의 Exit()로 이동
|
||||
}
|
||||
|
||||
// 공격 애니메이션 이벤트에서 호출될 함수
|
||||
public void StartAttackHitbox()
|
||||
{
|
||||
if (attackCollider != null)
|
||||
{
|
||||
attackCollider.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void EndAttackHitbox()
|
||||
{
|
||||
if (attackCollider != null)
|
||||
{
|
||||
attackCollider.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user