2023-07-19 00:17:25 -07:00
|
|
|
using Godot;
|
|
|
|
using SupaLidlGame.Entities;
|
|
|
|
|
|
|
|
namespace SupaLidlGame.State.NPC.Doc;
|
|
|
|
|
|
|
|
public partial class DocUnwantedFrequencyState : DocShungiteSpikeState
|
|
|
|
{
|
2023-07-21 02:54:13 -07:00
|
|
|
public override NPCState Enter(IState<NPCState> previous)
|
|
|
|
{
|
2023-07-22 20:23:48 -07:00
|
|
|
Doc.TelegraphAnimation.Play("unwanted_frequencies");
|
2023-07-21 02:54:13 -07:00
|
|
|
return base.Enter(previous);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void Exit(IState<NPCState> nextState)
|
|
|
|
{
|
|
|
|
GetNode<GpuParticles2D>("../../Effects/UnwantedFrequenciesParticles")
|
|
|
|
.Emitting = false;
|
2023-07-22 20:23:48 -07:00
|
|
|
base.Exit(nextState);
|
2023-07-21 02:54:13 -07:00
|
|
|
}
|
|
|
|
|
2023-07-19 00:17:25 -07:00
|
|
|
protected override Projectile SpawnProjectile(
|
|
|
|
Vector2 position,
|
|
|
|
Vector2 direction)
|
|
|
|
{
|
|
|
|
var projectile = _map.SpawnEntity<UnwantedFrequency>(Projectile);
|
|
|
|
projectile.Hitbox.Faction = NPC.Faction;
|
|
|
|
projectile.GlobalPosition = position;
|
|
|
|
projectile.Direction = direction;
|
|
|
|
projectile.Delay = 1.0 / Doc.Intensity;
|
|
|
|
return projectile;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Attack()
|
|
|
|
{
|
2023-07-22 20:23:48 -07:00
|
|
|
Doc.TelegraphAnimation.Play("unwanted_frequencies");
|
2023-07-19 00:17:25 -07:00
|
|
|
var docPos = NPC.GlobalPosition;
|
2023-08-03 10:09:12 -07:00
|
|
|
var projectile = SpawnProjectile(docPos, Vector2.Zero)
|
2023-07-19 00:17:25 -07:00
|
|
|
as UnwantedFrequency;
|
2023-07-31 01:12:47 -07:00
|
|
|
projectile.CharacterTarget = NPC.FindBestTarget();
|
2023-07-19 00:17:25 -07:00
|
|
|
|
|
|
|
_currentAttackDuration = 1;
|
|
|
|
_currentAttacks++;
|
|
|
|
}
|
|
|
|
}
|