You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
537 B
25 lines
537 B
using Godot;
|
|
using System;
|
|
|
|
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;
|
|
}
|
|
|
|
}
|