using Godot;

namespace Cirno.Scripts.Actors;

[Tool]
public partial class ChestMarker : FeatureMarker
{
    private Texture2D _markerTexture;

    [Export]
    public Texture2D MarkerTexture
    {
        get => _markerTexture;
        set
        {
            _markerTexture = value;
            if (Engine.IsEditorHint())
            {
                QueueRedraw();
            }
        }
    }
    
    public override void _Draw()
    {
        if (!Engine.IsEditorHint()) return;
        if (MarkerTexture is null) return;

        DrawTexture(MarkerTexture, -new Vector2(MarkerTexture.GetWidth() / 2f, MarkerTexture.GetHeight() / 2f));
    }
}