void InputDesktop() { Vector3 pickerPosition; Vector3Int pickerTile; SelectionState interfaceState = InterfaceSelectionManager.instance.state; if (Input.GetKeyDown(KeyCode.Mouse0) && !TouchInput.IsPointerConsumedByUI()) { TouchInput.inputMode = InputMode.Mouse; if (GetPickerTile(Input.mousePosition, PickMask.Construct, out pickerTile)) { mouseDragging = true; lastMouseDragPosition = pickerTile; if (!TileSelectionManager.instance.SetSelection(pickerTile)) { if (interfaceState.selectionMode == SelectionMode.Conveyor) { mouseDraggingConveyor = true; if (!ConveyorSystem.instance.conveyors.TryGetValue(pickerTile, out Conveyor conveyor)) { conveyor = ConveyorSystem.instance.CreateConveyor(pickerTile, ConveyorCreateFlags.None); if (conveyor) { TileSelectionManager.instance.SetSelection(conveyor); } } } } } } if (Input.GetKey(KeyCode.Mouse0) && mouseDragging) { TouchInput.inputMode = InputMode.Mouse; if (GetPickerTile(Input.mousePosition, PickMask.Construct, out pickerTile) && pickerTile != lastMouseDragPosition) { Conveyor conveyor = null; if (lastMouseDragPosition.IsNeighbor(pickerTile)) { mouseDraggingConveyor = true; conveyor = ConveyorSystem.instance.GetOrCreateConveyor(lastMouseDragPosition, pickerTile, ConveyorCreateFlags.SelectConveyor); } else { conveyor = ConveyorSystem.instance.CreateConveyor(pickerTile, ConveyorCreateFlags.SelectConveyor); } lastMouseDragPosition = pickerTile; } } Pickable pickable; if (Input.GetKeyUp(KeyCode.Mouse0)) { TouchInput.inputMode = InputMode.Mouse; if (!mouseDraggingConveyor && interfaceState.selectionMode == SelectionMode.Machine && !TouchInput.IsPointerConsumedByUI()) { if (GetPickerPosition(Input.mousePosition, PickMask.Construct, out pickerPosition, out pickable)) { Bounds3Int bounds = pickerPosition.PositionBottomToBounds(interfaceState.machineInfo.size); Machine machine = MachineSystem.instance.CreateMachine(interfaceState.machineInfo, bounds); if (machine) { machine.Drop(); TileSelectionManager.instance.SetSelection(machine); } } } mouseDragging = false; mouseDraggingConveyor = false; } OnClick(Input.GetKeyUp(KeyCode.Mouse0)); if (interfaceState.selectionMode == SelectionMode.Machine && GetPickerPosition(Input.mousePosition, PickMask.Construct, out pickerPosition, out pickable)) { TouchInput.inputMode = InputMode.Mouse; machineCreationVisualizer.Visualize(interfaceState.machineInfo, pickerPosition); machineCreationVisualizer.SetVisible(true); } else { machineCreationVisualizer.SetVisible(false); } if (Input.GetKey(KeyCode.Mouse1) && !TouchInput.IsPointerConsumedByUI()) { TouchInput.inputMode = InputMode.Mouse; if (GetPickerTile(Input.mousePosition, PickMask.Demolish, out pickerTile)) { Machine machine = MachineSystem.instance.GetMachine(pickerTile); if (machine) { if (TileSelectionManager.instance.selectionState.machine == machine) { TileSelectionManager.instance.TrySelectAnyInput(false); } machine.Demolish(); } else if (ConveyorSystem.instance.conveyors.TryGetValue(pickerTile, out Conveyor conveyor)) { if (TileSelectionManager.instance.selectionState.conveyor == conveyor) { TileSelectionManager.instance.TrySelectAnyInput(false); } conveyor.Demolish(); } } } }