summaryrefslogtreecommitdiff
path: root/Other/NodeEditorExamples/Assets/UNEB/Editor/Actions/RemoveConnection.cs
blob: 341e9f63a4fccfeee1220b9067992bb81169a5d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

using UnityEngine;

namespace UNEB
{
    public class RemoveConnection : UndoableAction
    {

        private NodeOutput _output;
        private NodeInput _input;

        public override void Do()
        {
            _input = manager.window.state.selectedInput;
            _output = _input.Outputs[0];

            _output.Remove(_input);

            manager.window.state.selectedInput = null;
        }

        public override void Undo()
        {
            _output.Add(_input);
        }

        public override void Redo()
        {
            _output.Remove(_input);
        }
    }
}