SupaLidlGame/State/Character/NPCIdleState.cs

26 lines
569 B
C#
Raw Permalink Normal View History

2022-11-13 15:42:04 -08:00
using Godot;
2023-06-03 18:21:46 -07:00
namespace SupaLidlGame.State.Character;
public partial class NPCIdleState : NPCState
2022-11-13 15:42:04 -08:00
{
2023-06-03 18:21:46 -07:00
[Export]
public CharacterState MoveState { get; set; }
2022-11-13 15:42:04 -08:00
2023-06-03 18:21:46 -07:00
public override CharacterState Process(double delta)
{
base.Process(delta);
2023-07-22 20:23:48 -07:00
if (Character.Direction.LengthSquared() > 0.01f)
2022-11-13 15:42:04 -08:00
{
2023-06-03 18:21:46 -07:00
return MoveState;
2022-11-13 15:42:04 -08:00
}
2023-06-03 18:21:46 -07:00
return null;
}
2022-11-19 21:21:12 -08:00
2023-07-27 11:39:24 -07:00
public override IState<CharacterState> Enter(IState<CharacterState> prev)
2023-06-03 18:21:46 -07:00
{
2023-07-27 11:39:24 -07:00
Character.MovementAnimation?.Play("idle");
return base.Enter(prev);
2022-11-13 15:42:04 -08:00
}
}