public void BreakAllConnections() { if (Type == LetTypes.INLET) { for (int i = 0; i < Connections.Count; i++) { Outlet outlet = Connections[i].Outlet; if (outlet != null) { outlet.Emit -= ((Inlet)this).Slot; } } } else if (Type == LetTypes.OUTLET) { for (int i = 0; i < Connections.Count; i++) { ((Outlet)this).Emit -= Connections[i].Inlet.Slot; } } for (int i = 0; i < Connections.Count; i++) { Outlet outlet = Connections[i].Outlet; if (outlet != null) { outlet.RemoveLet(this); } } Connections.Clear(); }
void BreakConnectionMenu(Inlet inlet, Outlet outlet) { GenericMenu genericMenu = new GenericMenu(); genericMenu.AddItem(new GUIContent("Break Connection"), false, () => { inlet.RemoveLet(outlet); outlet.RemoveLet(inlet); }); genericMenu.ShowAsContext(); }