SupaLidlGame/State/Character/CharacterStateMachine.cs

41 lines
981 B
C#
Raw Normal View History

2023-05-25 15:28:33 -07:00
using Godot;
namespace SupaLidlGame.State.Character
{
public partial class CharacterStateMachine : StateMachine<CharacterState>
{
[Export]
public override CharacterState InitialState { get; set; }
[Export]
public Characters.Character Character { get; set; }
public void Process(double delta)
{
var state = CurrentState.Process(delta);
if (state is CharacterState)
{
ChangeState(state);
}
}
public void PhysicsProcess(double delta)
{
var state = CurrentState.PhysicsProcess(delta);
if (state is CharacterState)
{
ChangeState(state);
}
}
public void Input(InputEvent @event)
{
var state = CurrentState.Input(@event);
if (state is not null)
{
ChangeState(state);
}
}
}
}