mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
37 lines
1 KiB
C#
37 lines
1 KiB
C#
using Cirno.Scripts.Actors;
|
|
using Godot;
|
|
|
|
namespace Cirno.Scripts.Resources;
|
|
|
|
[GlobalClass]
|
|
public partial class SimpleMovementPattern : AttackPattern
|
|
{
|
|
[Export] private Vector2 relativeTargetPosition;
|
|
[Export] private float moveDuration = 2f;
|
|
[Export] private Tween.TransitionType transitionType = Tween.TransitionType.Linear;
|
|
[Export] private Tween.EaseType easeType = Tween.EaseType.InOut;
|
|
|
|
private Tween tween;
|
|
private bool isComplete = false;
|
|
|
|
public override void Start(Boss boss)
|
|
{
|
|
Boss = boss;
|
|
tween = boss.CreateTween();
|
|
isComplete = false;
|
|
|
|
Vector2 targetPosition = (Boss?.HomePosition ?? boss.GlobalPosition) + relativeTargetPosition;
|
|
|
|
tween.TweenProperty(Boss, "position", targetPosition, moveDuration)
|
|
.SetTrans(transitionType)
|
|
.SetEase(easeType)
|
|
.Finished += () => isComplete = true;
|
|
}
|
|
|
|
public override void UpdatePattern(double delta) { }
|
|
|
|
public override bool IsComplete()
|
|
{
|
|
return isComplete;
|
|
}
|
|
}
|