public override void Undo() { if (CanUndo) { BTEditorGraphNode createdNode = m_graph.GetNodeByHash(m_createdNodeHash); m_parentNodeHash = m_graph.GetNodeHash(createdNode.Parent); m_serializedNode = BTUtils.SerializeNode(createdNode.Node); createdNode.OnDelete(); m_createdNodeHash = null; } }
public UndoNodeMoved(BTEditorGraphNode node) { m_graph = node.Graph; m_nodeHash = m_graph.GetNodeHash(node); m_startPosition = node.Node.Position; m_endPosition = Vector2.zero; }
public UndoNodeCreated(BTEditorGraphNode node) { m_graph = node.Graph; m_createdNodeHash = m_graph.GetNodeHash(node); m_parentNodeHash = null; m_serializedNode = null; Title = "Created " + node.Node.Title; }
public UndoNodeDeleted(BTEditorGraphNode node, int childIndex) { m_graph = node.Graph; m_parentNodeHash = m_graph.GetNodeHash(node.Parent); m_serializedNode = BTUtils.SerializeNode(node.Node); m_childIndex = childIndex; Title = "Deleted " + node.Node.Title; m_createdNodeHash = null; }
public UndoNodeGroupPop(BTEditorGraphNode node) { if (!(node.Node is NodeGroup)) { throw new System.ArgumentException("BT graph node is not of type NodeGroup", "node"); } m_graph = node.Graph; m_nodeGroupHash = m_graph.GetNodeHash(node); Title = "Close " + (string.IsNullOrEmpty(node.Node.Name) ? node.Node.Title : node.Node.Name); }
public override void Undo() { if (CanUndo) { BehaviourNode node = BTUtils.DeserializeNode(m_serializedNode); if (m_childIndex >= 0) { var parentNode = m_graph.GetNodeByHash(m_parentNodeHash); var createdNode = parentNode.OnInsertChild(m_childIndex, node); m_createdNodeHash = m_graph.GetNodeHash(createdNode); } else { var parentNode = m_graph.GetNodeByHash(m_parentNodeHash); var createdNode = parentNode.OnCreateChild(node); m_createdNodeHash = m_graph.GetNodeHash(createdNode); } m_parentNodeHash = null; m_serializedNode = null; } }