+ Red Sprite V3(이누야샤) 캐릭터 추가 + 03.CombatTest Scene(전투 테스트용 씬) 추가 + 4방향 Idle, Walk, Dash, ComboAttack 구현 + ComboAttack 애니메이션 복제 및 수정
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
public class Dash : StateMachineBehaviour
|
|
{
|
|
private CombatPlayer combatPlayer;
|
|
|
|
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
|
{
|
|
if (combatPlayer == null)
|
|
{
|
|
combatPlayer = animator.GetComponentInParent<CombatPlayer>();
|
|
}
|
|
combatPlayer.IsDashing = true;
|
|
combatPlayer.EnableDash = false;
|
|
}
|
|
|
|
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
|
{
|
|
combatPlayer.Rb.velocity = combatPlayer.PreviousDir * combatPlayer.DashForce;
|
|
|
|
if (stateInfo.normalizedTime >= 1.0f)
|
|
{
|
|
animator.SetBool(combatPlayer.isDashingHash, false);
|
|
}
|
|
}
|
|
|
|
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
|
{
|
|
combatPlayer.IsDashing = false;
|
|
animator.SetBool(combatPlayer.isDashingHash, false);
|
|
|
|
combatPlayer.CoolDown(combatPlayer.DashCooldown, () => combatPlayer.EnableDash = true);
|
|
}
|
|
}
|
|
} |