private void HandleWireCreation() { if (Input.GetMouseButtonDown(0)) { // Wire can be created from a pin, or from another wire (in which case it uses that wire's start pin) if (pinUnderMouse || highlightedWire) { RequestFocus(); if (HasFocus) { currentState = State.PlacingWire; wireToPlace = Instantiate(wirePrefab, parent: wireHolder); // Creating new wire starting from pin if (pinUnderMouse) { wireStartPin = pinUnderMouse; wireToPlace.ConnectToFirstPin(wireStartPin); } // Creating new wire starting from existing wire else if (highlightedWire) { wireStartPin = highlightedWire.ChipOutputPin; wireToPlace.ConnectToFirstPinViaWire(wireStartPin, highlightedWire, InputHelper.MouseWorldPos); } } } } }