mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-05 10:05:55 +00:00
Danmaku system
This commit is contained in:
parent
9c8ec486fc
commit
fdec052c16
38 changed files with 924 additions and 9 deletions
47
Scripts/AttackPatterns/SpiralPattern.cs
Normal file
47
Scripts/AttackPatterns/SpiralPattern.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using Cirno.Scripts.Actors;
|
||||
using Cirno.Scripts.Components;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.AttackPatterns;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class SpiralPattern : AttackPattern
|
||||
{
|
||||
[Export] public PackedScene BulletScene;
|
||||
[Export] private float bulletSpeed = 5f;
|
||||
[Export] private int bulletCount = 16;
|
||||
[Export] private float rotationSpeed = 90f;
|
||||
[Export] private float duration = 5f;
|
||||
[Export] private float burstInterval = 0.5f;
|
||||
[Export] private float spread = 360f;
|
||||
[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 = burstInterval; // start immediately
|
||||
spawner = boss.GetNode<BulletSpawner>("BulletSpawner");
|
||||
}
|
||||
|
||||
public override void UpdatePattern(double delta)
|
||||
{
|
||||
timer += delta;
|
||||
burstTimer += delta;
|
||||
if (timer < duration && burstTimer >= burstInterval)
|
||||
{
|
||||
spawner.SpawnSpiralPattern(Boss.GlobalPosition, bulletSpeed, owner, bulletCount, rotationSpeed, timer, spread, BulletScene);
|
||||
burstTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsComplete()
|
||||
{
|
||||
return timer >= duration;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue