SupaLidlGame/State/NPC/Doc/DocTelegraphState.cs

42 lines
954 B
C#
Raw Normal View History

2023-07-13 23:46:58 -07:00
using Godot;
namespace SupaLidlGame.State.NPC.Doc;
public partial class DocTelegraphState : NPCState
{
[Export]
public AnimationPlayer TelegraphAnimationPlayer { get; set; }
[Export]
2023-07-18 00:57:28 -07:00
public DocChooseAttackState AttackState { get; set; }
2023-07-13 23:46:58 -07:00
[Export]
public double Duration { get; set; } = 1;
private double _currentDuration = 1;
public override NPCState Enter(IState<NPCState> previousState)
{
_currentDuration = Duration;
TelegraphAnimationPlayer.Play("enter_in");
2023-07-22 20:23:48 -07:00
float randX = GD.RandRange(-112, 112);
float randY = GD.RandRange(-112, 112);
2023-07-13 23:46:58 -07:00
NPC.GlobalPosition = new Vector2(randX, randY);
return null;
}
public override void Exit(IState<NPCState> nextState)
{
}
public override NPCState Process(double delta)
{
if ((_currentDuration -= delta) <= 0)
{
return AttackState;
}
return null;
}
}