2025-07-09 23:50:43 +02:00
|
|
|
using Godot;
|
2025-07-31 21:44:17 +02:00
|
|
|
|
|
|
|
|
namespace Babushka.scripts.CSharp.Common.Animation;
|
2025-07-09 23:50:43 +02:00
|
|
|
|
|
|
|
|
public partial class AnimationStarter : Node2D
|
|
|
|
|
{
|
|
|
|
|
[Export] private AnimationPlayer _animationPlayer;
|
|
|
|
|
[Export] private string _animationName;
|
|
|
|
|
[Export] private bool _repeatable = true;
|
|
|
|
|
|
|
|
|
|
private bool _played;
|
|
|
|
|
|
|
|
|
|
public void PlayAnimation()
|
|
|
|
|
{
|
|
|
|
|
if (_animationPlayer == null || string.IsNullOrEmpty(_animationName))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!_repeatable && _played)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_animationPlayer.Play(_animationName);
|
|
|
|
|
_played = true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-31 21:44:17 +02:00
|
|
|
}
|