mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 06:35:55 +00:00
Scriptable bullet emitter
This commit is contained in:
parent
d62538a382
commit
4261009c33
17 changed files with 251 additions and 74 deletions
|
|
@ -23,16 +23,14 @@ public partial class TargetedPattern : AttackPattern
|
|||
private double burstTimer;
|
||||
private BulletSpawner spawner;
|
||||
//private Node2D player;
|
||||
private GameManager _gameManager;
|
||||
|
||||
public override void Start(Boss boss)
|
||||
public override void Start(Node2D parent)
|
||||
{
|
||||
_gameManager = boss.GetNode<GameManager>("/root/GameScene");
|
||||
|
||||
Boss = boss;
|
||||
Parent = parent;
|
||||
timer = 0;
|
||||
burstTimer = 0;
|
||||
spawner = boss.GetNode<BulletSpawner>("BulletSpawner");
|
||||
spawner = Parent.GetNode<BulletSpawner>("BulletSpawner");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -40,9 +38,9 @@ public partial class TargetedPattern : AttackPattern
|
|||
{
|
||||
timer += delta;
|
||||
burstTimer += delta;
|
||||
if (timer < duration && burstTimer >= burstInterval && _gameManager.PlayerPosition.HasValue)
|
||||
if (timer < duration && burstTimer >= burstInterval && GameManager.Instance.PlayerPosition.HasValue)
|
||||
{
|
||||
spawner.SpawnTargetedBullet(Boss.GlobalPosition, _gameManager.PlayerPosition.Value, bulletSpeed, owner, BulletScene, bulletsPerShot, spread, modifier);
|
||||
spawner.SpawnTargetedBullet(Parent.GlobalPosition, GameManager.Instance.PlayerPosition.Value, bulletSpeed, owner, BulletScene, bulletsPerShot, spread, modifier);
|
||||
burstTimer = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue