21 lines
598 B
C#

using System.Collections;
using UnityEngine;
namespace State.PawnStateMachine
{
public class Attack : GameState
{
public override void OnEnter(StateMachine machine)
{
base.OnEnter(machine);
StateMachine.StartCoroutine(PlayAttackAnimation());
}
private IEnumerator PlayAttackAnimation()
{
var animationLength = ((PawnStateMachine)StateMachine).controlledPawn.HandleAttack("Attack1");
yield return new WaitForSeconds(animationLength);
StateMachine.ChangeState(new Idle());
}
}
}