mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:45:33 +00:00
45 lines
No EOL
1.2 KiB
C#
45 lines
No EOL
1.2 KiB
C#
using Cirno.Scripts.Actors;
|
|
using Cirno.Scripts.Components;
|
|
using Cirno.Scripts.Resources;
|
|
using Godot;
|
|
|
|
namespace Cirno.Scripts.AttackPatterns;
|
|
|
|
[GlobalClass]
|
|
public partial class PatternTest : AttackPattern
|
|
{
|
|
[Export] public PackedScene BulletScene;
|
|
[Export] private float bulletSpeed = 5f;
|
|
[Export] private int bulletCount = 12;
|
|
[Export] private float duration = 3f;
|
|
[Export] private float burstInterval = 0.5f;
|
|
[Export] private BulletOwner owner = BulletOwner.Enemy;
|
|
|
|
private double timer;
|
|
private double burstTimer;
|
|
private BulletSpawner spawner;
|
|
|
|
public override void Start(Boss boss)
|
|
{
|
|
Boss = boss;
|
|
timer = 0;
|
|
burstTimer = 0;
|
|
spawner = boss.GetNode<BulletSpawner>("BulletSpawner");
|
|
}
|
|
|
|
public override void UpdatePattern(double delta)
|
|
{
|
|
timer += delta;
|
|
burstTimer += delta;
|
|
if (timer < duration && burstTimer >= burstInterval)
|
|
{
|
|
spawner.SpawnBullet(Boss.GlobalPosition, Vector2.Right, bulletSpeed, owner, bulletCount, bulletScene: BulletScene);
|
|
burstTimer = 0;
|
|
}
|
|
}
|
|
|
|
public override bool IsComplete()
|
|
{
|
|
return timer >= duration;
|
|
}
|
|
} |