Esempio n. 1
0
    private void EndBoundMultiSelection()
    {
        isDoingSquareMultiSelection = false;
        mousePressed = false;
        freeCameraController.SetCameraCanMove(true);
        List <DCLBuilderInWorldEntity> allEntities = null;

        if (!isVoxelBoundMultiSelection)
        {
            allEntities = builderInWorldEntityHandler.GetAllEntitiesFromCurrentScene();
        }
        else
        {
            allEntities = builderInWorldEntityHandler.GetAllVoxelsEntities();
        }

        foreach (DCLBuilderInWorldEntity entity in allEntities)
        {
            if (entity.isVoxel && !isVoxelBoundMultiSelection)
            {
                continue;
            }
            if (entity.rootEntity.meshRootGameObject && entity.rootEntity.meshesInfo.renderers.Length > 0)
            {
                if (BuilderInWorldUtils.IsWithInSelectionBounds(entity.rootEntity.meshesInfo.mergedBounds.center, lastMousePosition, Input.mousePosition))
                {
                    builderInWorldEntityHandler.SelectEntity(entity);
                }
            }
        }

        outlinerController.SetOutlineCheckActive(true);
        outlinerController.CancelAllOutlines();
    }
Esempio n. 2
0
    private void Update()
    {
        if (isPlacingNewObject)
        {
            if (!voxelController.IsActive())
            {
                SetEditObjectAtMouse();
            }
            else
            {
                voxelController.SetEditObjectLikeVoxel();
            }
        }
        else if (isSquareMultiSelectionInputActive && isMouseDragging)
        {
            List <DCLBuilderInWorldEntity> allEntities = null;
            if (!isTypeOfBoundSelectionSelected || !isVoxelBoundMultiSelection)
            {
                allEntities = builderInWorldEntityHandler.GetAllEntitiesFromCurrentScene();
            }
            else if (isVoxelBoundMultiSelection)
            {
                allEntities = builderInWorldEntityHandler.GetAllVoxelsEntities();
            }

            foreach (DCLBuilderInWorldEntity entity in allEntities)
            {
                if (entity.isVoxel && !isVoxelBoundMultiSelection && isTypeOfBoundSelectionSelected)
                {
                    continue;
                }
                if (entity.rootEntity.meshRootGameObject && entity.rootEntity.meshesInfo.renderers.Length > 0)
                {
                    if (BuilderInWorldUtils.IsWithInSelectionBounds(entity.rootEntity.meshesInfo.mergedBounds.center, lastMousePosition, Input.mousePosition))
                    {
                        if (!isTypeOfBoundSelectionSelected && !entity.IsLocked)
                        {
                            if (entity.isVoxel)
                            {
                                isVoxelBoundMultiSelection = true;
                            }
                            else
                            {
                                isVoxelBoundMultiSelection = false;
                            }
                            isTypeOfBoundSelectionSelected = true;
                        }

                        outlinerController.OutlineEntity(entity);
                    }
                    else
                    {
                        outlinerController.CancelEntityOutline(entity);
                    }
                }
            }
        }
    }
Esempio n. 3
0
    private void EndBoundMultiSelection()
    {
        freeCameraController.SetCameraCanMove(true);
        List <DCLBuilderInWorldEntity> allEntities = null;

        if (!isVoxelBoundMultiSelection)
        {
            allEntities = builderInWorldEntityHandler.GetAllEntitiesFromCurrentScene();
        }
        else
        {
            allEntities = builderInWorldEntityHandler.GetAllVoxelsEntities();
        }

        List <DCLBuilderInWorldEntity> selectedInsideBoundsEntities = new List <DCLBuilderInWorldEntity>();
        int alreadySelectedEntities = 0;

        if (!isMultiSelectionActive)
        {
            builderInWorldEntityHandler.DeselectEntities();
        }

        foreach (DCLBuilderInWorldEntity entity in allEntities)
        {
            if ((entity.isVoxel && !isVoxelBoundMultiSelection) ||
                !entity.IsVisible)
            {
                continue;
            }

            if (entity.rootEntity.meshRootGameObject && entity.rootEntity.meshesInfo.renderers.Length > 0)
            {
                if (BuilderInWorldUtils.IsWithInSelectionBounds(entity.rootEntity.meshesInfo.mergedBounds.center, lastMousePosition, Input.mousePosition) &&
                    !entity.IsLocked)
                {
                    if (entity.IsSelected)
                    {
                        alreadySelectedEntities++;
                    }

                    builderInWorldEntityHandler.SelectEntity(entity);
                    selectedInsideBoundsEntities.Add(entity);
                }
            }
        }
        if (selectedInsideBoundsEntities.Count == alreadySelectedEntities && alreadySelectedEntities > 0)
        {
            foreach (DCLBuilderInWorldEntity entity in selectedInsideBoundsEntities)
            {
                builderInWorldEntityHandler.DeselectEntity(entity);
            }
        }

        outlinerController.CancelAllOutlines();
    }
Esempio n. 4
0
    public void EndMultiVoxelSelection()
    {
        List <DCLBuilderInWorldEntity> voxelEntities = builderInWorldEntityHandler.GetAllVoxelsEntities();

        foreach (DCLBuilderInWorldEntity voxelEntity in voxelEntities)
        {
            if (BuilderInWorldUtils.IsWithInSelectionBounds(voxelEntity.gameObject.transform, lastMousePosition, Input.mousePosition))
            {
                builderInWorldEntityHandler.SelectEntity(voxelEntity);
            }
        }
        outlinerController.SetOutlineCheckActive(true);
        outlinerController.CancelAllOutlines();
    }