72 lines
1.5 KiB
C#
72 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/Bullets/FoxRotateAround.cs")]
|
|
public partial class FoxRotateAround : Node2D
|
|
{
|
|
[Export(PropertyHint.None, "")]
|
|
private NodePath bulletSpawner;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private NodePath anim;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private WaveBullets wave;
|
|
|
|
private Entity entity;
|
|
|
|
private Node2D spawner;
|
|
|
|
private Vector2 start;
|
|
|
|
private AnimationPlayer aplayer;
|
|
|
|
private float cd;
|
|
|
|
public override void _EnterTree()
|
|
{
|
|
spawner = GetNode<Node2D>(bulletSpawner);
|
|
entity = BattleDR.current.enemies[0].entity;
|
|
aplayer = GetNode<AnimationPlayer>(anim);
|
|
entity.doTrail = true;
|
|
start = entity.GlobalPosition;
|
|
entity.Reparent(this);
|
|
entity.anim.Play("FrontAtk");
|
|
entity.Modulate = Main.colorWhite;
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
entity.GlobalPosition = entity.GlobalPosition.Lerp(spawner.GlobalPosition, Main.deltaTime * 0.15f);
|
|
if (cd < 30f)
|
|
{
|
|
cd += Main.deltaTime;
|
|
}
|
|
else if (cd < 1000f)
|
|
{
|
|
if (spawner.ProcessMode == ProcessModeEnum.Disabled)
|
|
{
|
|
spawner.ProcessMode = ProcessModeEnum.Inherit;
|
|
}
|
|
cd = 1500f;
|
|
if (BattleDR.current.enemies[0].HPPercent() < 0.6f || BattleDR.current.enemies[0].spare > 50)
|
|
{
|
|
wave.skip = 1;
|
|
wave.skipVariance = 0;
|
|
wave.delay = 35f;
|
|
aplayer.Play("Anim");
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void _ExitTree()
|
|
{
|
|
entity.Reparent(BattleDR.current);
|
|
entity.GlobalPosition = start;
|
|
}
|
|
|
|
}
|