using Godot;

namespace Cirno.Scripts.Components.Actors;

public partial class PlayerHitboxSpriteProvider : Node2D
{
    [Export]
    public AnimatedSprite2D Hitbox { get; private set; }
    [Export]
    public AnimatedSprite2D Circle { get; private set; }
    [Export]
    public AnimatedSprite2D Square { get; private set; }

    [Export] public float RotationSpeed { get; private set; } = 10f;

    public override void _Process(double delta)
    {
        if (!Visible) return;
        Circle.Rotate((float)(RotationSpeed * delta));
        Square.Rotate((float)(-RotationSpeed * delta));
    }
    
    public void SetVisibility(bool isVisible)
    {
        if (isVisible == Visible) return;
        if (isVisible)
        {
            Show();
        }
        else
        {
            Hide();
        }
    }
    
    // public void Show()
    // {
    //     Hitbox.Show();
    //     Circle.Show();
    // }
    //
    // public void Hide()
    // {
    //     Hitbox.Hide();
    //     Circle.Hide();
    // }
}