/// <summary> /// Shows the connection context menu. /// </summary> /// <param name="connectionNode"></param> private void ShowConnectionContextMenu(ConnectionNode connectionNode) { var genericMenu = new GenericMenu(); genericMenu.AddItem(new GUIContent("Delete connection"), false, () => DeleteConnectionNode(connectionNode)); genericMenu.ShowAsContext(); }
/// <summary> /// Deletes a given connection node. /// </summary> /// <param name="connectionNode"></param> private void DeleteConnectionNode(ConnectionNode connectionNode) { LevelGraph.Connections.Remove(connectionNode.Connection); DestroyImmediate(connectionNode.Connection, true); connectionNodes.Remove(connectionNode); EditorUtility.SetDirty(LevelGraph); }
/// <summary> /// Create a connection node from a given connection. /// </summary> /// <param name="connection"></param> /// <returns></returns> public ConnectionNode CreateConnectionNode(ConnectionBase connection) { var from = roomNodes.Single(x => x.Room == connection.From); var to = roomNodes.Single(x => x.Room == connection.To); var connectionNode = new ConnectionNode(connection, from, to); connectionNodes.Add(connectionNode); return(connectionNode); }