mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Danmaku system
This commit is contained in:
parent
9c8ec486fc
commit
fdec052c16
38 changed files with 924 additions and 9 deletions
37
Scripts/Resources/SimpleMovementPattern.cs
Normal file
37
Scripts/Resources/SimpleMovementPattern.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue