Beispiel #1
0
    public void SelectNode(Node2D node)
    {
        if (_currentSelectedNode != null && _currentSelectedNode.IsConnected("FinishedMovement", this, "_on_Player_FinishedMovement"))
        {
            _currentSelectedNode.Disconnect("FinishedMovement", this, "_on_Player_FinishedMovement");
        }

        _currentSelectedNode = node;

        _currentSelectedNode.Connect("FinishedMovement", this, "_on_Player_FinishedMovement");

        if (node is Player player)
        {
            var position = player.GetGridPosition();
            _on_Player_FinishedMovement(position.Column, position.Row, player.GetDirection());
        }
    }