Scriptable bullet emitter

This commit is contained in:
MaddoScientisto 2025-03-15 11:44:30 +01:00
commit 4261009c33
17 changed files with 251 additions and 74 deletions

View file

@ -16,23 +16,28 @@ public partial class MovementPattern : AttackPattern
private Tween tween;
private bool isComplete = false;
public override void Start(Boss boss)
protected IScriptHost Boss;
public override void Start(Node2D parent)
{
if (parent is not IScriptHost boss)
return;
Boss = boss;
tween = boss.CreateTween();
tween = parent.CreateTween();
isComplete = false;
Vector2 targetPosition = (Boss?.HomePosition ?? boss.GlobalPosition) + this.relativeTargetPosition;
Vector2 targetPosition = (Boss?.HomePosition ?? parent.GlobalPosition) + this.relativeTargetPosition;
tween.TweenProperty(Boss, "position", targetPosition, moveDuration)
tween.TweenProperty(Parent, "position", targetPosition, moveDuration)
.SetTrans(transitionType)
.SetEase(easeType)
.Finished += () => isComplete = true;
if (shootingPattern != null && !WaitForCompletion)
{
shootingPattern.Start(boss);
shootingPattern.Start(Parent);
}
}