using Godot;
using System;

namespace Newlon;

public partial class Cursor : Node
{
    public static Cursor Instance { get; private set; }

    public bool shovel = false;
    public bool plant = false;

    public override void _Ready()
    {
        Instance = this;
        SetDefaultCursor();
    }

    public void UpdateCursor()
    {
        if (shovel) 
        {
            SetShovelCursor();
            return;
        }

        if (plant)
        {
            SetPlantCursor();
            return;
        }

        SetDefaultCursor() ;
    }

    public void SetDefaultCursor()
    {
        Input.SetCustomMouseCursor(ResourceLoader.Load<Texture2D>("res://assets/sprites/atlases/cursor/default_arrow.png"),shape:Input.CursorShape.Arrow);
        Input.SetCustomMouseCursor(ResourceLoader.Load<Texture2D>("res://assets/sprites/atlases/cursor/default_point.png"),shape:Input.CursorShape.PointingHand);
    }

    public void SetPlantCursor()
    {
        Input.SetCustomMouseCursor(ResourceLoader.Load<Texture2D>("res://assets/sprites/atlases/cursor/plant_arrow.png"));
    }

    public void SetShovelCursor()
    {
        Input.SetCustomMouseCursor(ResourceLoader.Load<Texture2D>("res://assets/sprites/atlases/cursor/shovel_arrow.png"));
    }
}
