2023-08-05 23:50:08 -07:00
|
|
|
using Godot;
|
|
|
|
|
2023-08-08 00:54:00 -07:00
|
|
|
namespace SupaLidlGame.Extensions;
|
|
|
|
|
2023-08-05 23:50:08 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|