parent
620e91a20a
commit
0b09e12345
@ -1,26 +1,40 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class EnemyStateAttack : IEnemyState
|
public class EnemyStateAttack : IEnemyState
|
||||||
{
|
{
|
||||||
|
private static readonly int VertiSlash = Animator.StringToHash("VertiSlash");
|
||||||
|
private static readonly int VertiAttack = Animator.StringToHash("VertiAttack");
|
||||||
|
|
||||||
private EnemyController _enemyController;
|
private EnemyController _enemyController;
|
||||||
private Animator _animator;
|
private Animator _animator;
|
||||||
private Coroutine _attackRoutine;
|
private Coroutine _attackRoutine;
|
||||||
|
|
||||||
|
private enum AttackType
|
||||||
|
{
|
||||||
|
VerticalAttack, // 위에서 아래로 베는 것
|
||||||
|
HorizontalAttack, // 옆으로 베는 것
|
||||||
|
ChariotAttack, // 원형
|
||||||
|
DynamoAttack, // 도넛
|
||||||
|
};
|
||||||
|
|
||||||
|
private AttackType _currentAttackType;
|
||||||
|
|
||||||
public void Enter(EnemyController enemyController)
|
public void Enter(EnemyController enemyController)
|
||||||
{
|
{
|
||||||
_enemyController = enemyController;
|
_enemyController = enemyController;
|
||||||
_animator = _enemyController.EnemyAnimator;
|
_animator = _enemyController.EnemyAnimator;
|
||||||
|
|
||||||
_animator.SetBool("Attack", true);
|
_animator.SetBool(VertiAttack, true);
|
||||||
_attackRoutine = _enemyController.StartCoroutine(AttackSequence());
|
_attackRoutine = _enemyController.StartCoroutine(VerticalAttackSequence());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator AttackSequence()
|
private IEnumerator VerticalAttackSequence()
|
||||||
{
|
{
|
||||||
// 1. 전조 이펙트 생성
|
// 1. 전조 이펙트 생성
|
||||||
|
|
||||||
@ -32,7 +46,7 @@ public class EnemyStateAttack : IEnemyState
|
|||||||
// 4. 전조 제거
|
// 4. 전조 제거
|
||||||
|
|
||||||
// 5. 검 휘두르기
|
// 5. 검 휘두르기
|
||||||
_animator.SetTrigger("VertiSlash");
|
_animator.SetTrigger(VertiSlash);
|
||||||
|
|
||||||
// 6. 공격 판정 발생
|
// 6. 공격 판정 발생
|
||||||
|
|
||||||
@ -48,7 +62,7 @@ public class EnemyStateAttack : IEnemyState
|
|||||||
_enemyController.StopCoroutine(_attackRoutine);
|
_enemyController.StopCoroutine(_attackRoutine);
|
||||||
_attackRoutine = null;
|
_attackRoutine = null;
|
||||||
}
|
}
|
||||||
_animator.SetBool("Attack", false);
|
_animator.SetBool(VertiAttack, false);
|
||||||
_animator = null;
|
_animator = null;
|
||||||
_enemyController = null;
|
_enemyController = null;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
public void Enter(EnemyController enemyController)
|
public void Enter(EnemyController enemyController)
|
||||||
{
|
{
|
||||||
_enemyController = enemyController;
|
_enemyController = enemyController;
|
||||||
|
_enemyController.EnemyAnimator.SetTrigger("Dead");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user