30 lines
761 B
C#
30 lines
761 B
C#
using UnityEngine;
|
|
|
|
namespace State.PawnStateMachine
|
|
{
|
|
public class Idle : GameState
|
|
{
|
|
public override void OnEnter(StateMachine machine)
|
|
{
|
|
base.OnEnter(machine);
|
|
((PawnStateMachine)StateMachine).controlledPawn.HandleIdle();
|
|
}
|
|
|
|
public override void Handle(Vector2 input)
|
|
{
|
|
base.Handle(input);
|
|
((PawnStateMachine)StateMachine).controlledPawn.HandleMove(input);
|
|
}
|
|
|
|
public override void Handle(Command command)
|
|
{
|
|
base.Handle(command);
|
|
var newState = command switch
|
|
{
|
|
Command.Attack => new Attack(),
|
|
};
|
|
|
|
StateMachine.ChangeState(newState);
|
|
}
|
|
}
|
|
} |