SupaLidlGame/State/NPC/Doc/DocIntroState.cs

46 lines
920 B
C#
Raw Permalink Normal View History

2023-07-25 03:47:31 -07:00
using Godot;
namespace SupaLidlGame.State.NPC.Doc;
public partial class DocIntroState : NPCState
{
[Export]
public NPCState NextState { get; set; }
[Export]
public double Duration { get; set; }
private double _currentDuration;
private Characters.Doc _doc;
public override void _Ready()
{
base._Ready();
_doc = NPC as Characters.Doc;
}
public override NPCState Enter(IState<NPCState> previousState)
{
_currentDuration = Duration;
_doc.MiscAnimation.Play("intro");
2023-08-03 15:09:10 -07:00
_doc.CanAttack = false;
2023-07-25 03:47:31 -07:00
return null;
}
2023-08-03 15:09:10 -07:00
public override void Exit(IState<NPCState> nextState)
{
_doc.CanAttack = true;
base.Exit(nextState);
}
2023-07-25 03:47:31 -07:00
public override NPCState Process(double delta)
{
if ((_currentDuration -= delta) <= 0)
{
return NextState;
}
return null;
}
}