void HandleWirePlacement () { // Cancel placing wire if (InputHelper.AnyOfTheseKeysDown (KeyCode.Escape, KeyCode.Backspace, KeyCode.Delete) || Input.GetMouseButtonDown (1)) { StopPlacingWire (); } // Update wire position and check if user wants to try connect the wire else { Vector2 mousePos = InputHelper.MouseWorldPos; wireToPlace.UpdateWireEndPoint (mousePos); // Left mouse press if (Input.GetMouseButtonDown (0)) { // If mouse pressed over pin, try connecting the wire to that pin if (pinUnderMouse) { TryPlaceWire (wireStartPin, pinUnderMouse); } // If mouse pressed over empty space, add anchor point to wire else { wireToPlace.AddAnchorPoint (mousePos); } } // Left mouse release else if (Input.GetMouseButtonUp (0)) { if (pinUnderMouse && pinUnderMouse != wireStartPin) { TryPlaceWire (wireStartPin, pinUnderMouse); } } } }