SupaLidlGame/Extensions/AnimationPlayer.cs

25 lines
557 B
C#
Raw Normal View History

2023-08-05 23:50:08 -07:00
using Godot;
public static class AnimationPlayerExtensions
{
public static bool TryPlay(this AnimationPlayer player, string name)
{
var hasAnimation = player.HasAnimation(name);
if (hasAnimation)
{
player.Play(name);
}
return hasAnimation;
}
public static bool TryQueue(this AnimationPlayer player, string name)
{
var hasAnimation = player.HasAnimation(name);
if (hasAnimation)
{
player.Queue(name);
}
return hasAnimation;
}
}