using System.Threading.Tasks; using Godot; namespace Babushka.scripts.CSharp.Common.Temp; /// /// Temporary Duck behaviour to make sure we can use them in the first showcase /// public partial class MVPDuck : Node2D { [Export] private Node2D _penTarget; [Export] private int _transferDelayMs; [Export] private AnimationPlayer _animationPlayer; [Export] private string _flapAnimationName = "flapFlap"; public void TransferToTargetAfterDelay() { MoveAfterDelay(); PlayAnimation(); } private void PlayAnimation() { _animationPlayer.CurrentAnimation = _flapAnimationName; _animationPlayer.Play(); } public async void MoveAfterDelay() { await ToSignal(GetTree().CreateTimer(1.0f), "timeout"); // 1.0f seconds Position = _penTarget.GlobalPosition; // Now this works! } }