private void Update() { if (Input.GetMouseButtonDown(0)) { foreach (var selected in GetSelected(Input.mousePosition)) { var draggable = selected.GetComponent <Draggable>(); if (draggable != null) { selectedDraggable = draggable; break; } } } if (Input.GetMouseButtonUp(0)) { selectedDraggable = null; } if (selectedDraggable != null) { selectedDraggable.Drag(Input.mousePosition); } if (Input.GetMouseButtonDown(1) && CheckUiBlocks(Input.mousePosition)) { isUiBlocks = true; } if (Input.GetMouseButtonUp(1)) { isUiBlocks = false; } if (!isUiBlocks) { OverviewCamera.TargetRadius += -Input.GetAxis("Mouse ScrollWheel"); if (Input.GetMouseButton(1)) { OverviewCamera.TargetHorizontalRotation += Input.GetAxis("Mouse X"); OverviewCamera.TargetVerticalRotation += -Input.GetAxis("Mouse Y"); } } }
public void Register(Draggable draggable) { draggables.Add(draggable); }