Exemple #1
0
    private void MouseDown(int buttonId, Vector3 mousePosition)
    {
        lastTimeMouseDown = Time.unscaledTime;
        lastMousePosition = mousePosition;

        if (!canInputBeMade)
        {
            return;
        }
        if (!BuilderInWorldUtils.IsPointerOverUIElement() && !BuilderInWorldUtils.IsPointerOverMaskElement(layerToStopClick))
        {
            OnMouseDown?.Invoke(buttonId, mousePosition);
        }
    }
Exemple #2
0
    private void OnInputMouseDrag(int buttonId, Vector3 mousePosition, float axisX, float axisY)
    {
        if (Vector3.Distance(lastMousePosition, mousePosition) <= BuilderInWorldSettings.MOUSE_THRESHOLD_FOR_DRAG && !isMouseDragging)
        {
            return;
        }

        isMouseDragging = true;
        if (buttonId != 0 ||
            selectedEntities.Count <= 0 ||
            BuilderInWorldUtils.IsPointerOverMaskElement(layerToStopClick) ||
            isSquareMultiSelectionInputActive ||
            multiSelectionButtonPressed)
        {
            return;
        }

        if (!isDraggingStarted)
        {
            StarDraggingSelectedEntities();
        }

        if (canDragSelectedEntities)
        {
            Vector3 destination;
            Vector3 currentPoint = GetFloorPointAtMouse(mousePosition);


            if (isSnapActive)
            {
                currentPoint.x = Mathf.Round(currentPoint.x / snapDragFactor) * snapDragFactor;
                currentPoint.z = Mathf.Round(currentPoint.z / snapDragFactor) * snapDragFactor;
                destination    = currentPoint;
            }
            else
            {
                destination = currentPoint - dragStartedPoint + editionGO.transform.position;
            }

            editionGO.transform.position = destination;
            dragStartedPoint             = currentPoint;
        }
    }
Exemple #3
0
    private void MouseUp(int buttonId, Vector3 mousePosition)
    {
        if (!canInputBeMade)
        {
            return;
        }

        if (!BuilderInWorldUtils.IsPointerOverUIElement() && !BuilderInWorldUtils.IsPointerOverMaskElement(layerToStopClick))
        {
            OnMouseUp?.Invoke(buttonId, mousePosition);
            if (Vector3.Distance(mousePosition, lastMousePosition) >= movementClickThreshold)
            {
                return;
            }
            if (Time.unscaledTime >= lastTimeMouseDown + msClickThreshold / 1000)
            {
                return;
            }
            OnMouseClick?.Invoke(buttonId, mousePosition);
        }
    }
Exemple #4
0
    void OnInputMouseDown(int buttonID, Vector3 position)
    {
        lastMousePosition = position;

        if (buttonID == 1)
        {
            mouseSecondaryBtnPressed = true;
            freeCameraController.StartDectectingMovement();
        }

        if (buttonID != 0)
        {
            return;
        }

        dragStartedPoint = GetFloorPointAtMouse(position);

        if (isPlacingNewObject)
        {
            return;
        }

        var entity = builderInWorldEntityHandler.GetEntityOnPointer();

        if ((entity == null ||
             (entity != null && !entity.IsSelected)) &&
            !BuilderInWorldUtils.IsPointerOverMaskElement(layerToStopClick))
        {
            isSquareMultiSelectionInputActive = true;
            isTypeOfBoundSelectionSelected    = false;
            isVoxelBoundMultiSelection        = false;
            outlinerController.SetOutlineCheckActive(false);
        }
        mouseMainBtnPressed = true;
        freeCameraController.SetCameraCanMove(false);
    }