using Godot;

namespace Cirno.Scripts.Resources.Events;

[GlobalClass]
public partial class UpdateCheckPointEvent : EventResource
{
    private GameManager _gameManager;
    
    [Export]
    public NodePath Target { get; set; }
    
    public override void Init(Node2D parent)
    {
        _gameManager = parent.GetGameManager();
    }

    public override void Start(Node2D parent)
    {
        _gameManager.LastCheckpointPosition = parent.GetNode<Node2D>(Target).GlobalPosition;
        // _gameManager.Player.LastCheckPointPosition = parent.GetNode<Node2D>(Target).GlobalPosition;
    }

    public override void UpdateEvent(double delta)
    {
        
    }

    public override bool IsComplete()
    {
        return true;
    }
}