mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Player movement and camera
This commit is contained in:
parent
ed656f00bb
commit
a324f2e347
43 changed files with 1777 additions and 316 deletions
|
|
@ -14,14 +14,14 @@ public partial class MovementPattern : AttackPattern
|
|||
[Export] public Tween.EaseType easeType = Tween.EaseType.InOut;
|
||||
[Export] public AttackPattern shootingPattern;
|
||||
|
||||
public override IPatternMachine MakeMachine(Node2D parent)
|
||||
public override IPatternMachine MakeMachine(Node parent)
|
||||
{
|
||||
return new MovementPatternMachine(this, parent);
|
||||
}
|
||||
|
||||
public class MovementPatternMachine(MovementPattern pattern, Node2D parent) : IPatternMachine
|
||||
public class MovementPatternMachine(MovementPattern pattern, Node parent) : IPatternMachine
|
||||
{
|
||||
public Node2D Parent => parent;
|
||||
public Node Parent => parent;
|
||||
public MovementPattern Pattern { get; } = pattern;
|
||||
|
||||
private IPatternMachine _machine;
|
||||
|
|
@ -39,10 +39,11 @@ public partial class MovementPattern : AttackPattern
|
|||
Boss = boss;
|
||||
tween = parent.CreateTween();
|
||||
isComplete = false;
|
||||
|
||||
|
||||
Vector2 targetPosition = (Boss?.HomePosition ?? boss.ParentObject.GlobalPosition) + Pattern.relativeTargetPosition;
|
||||
|
||||
Vector2 targetPosition = (Boss?.HomePosition ?? parent.GlobalPosition) + Pattern.relativeTargetPosition;
|
||||
|
||||
tween.TweenProperty(Parent, "position", targetPosition, Pattern.moveDuration)
|
||||
tween.TweenProperty(boss.ParentObject, "position", targetPosition, Pattern.moveDuration)
|
||||
.SetTrans(Pattern.transitionType)
|
||||
.SetEase(Pattern.easeType)
|
||||
.Finished += () => isComplete = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue