Example #1
0
    public void EntityDuplicate()
    {
        DecentralandEntity      duplicateEntity = entityHandler.DuplicateEntity(entity);
        DCLBuilderInWorldEntity convertedEntity = entityHandler.GetConvertedEntity(duplicateEntity);

        Assert.IsNotNull(convertedEntity);
    }
Example #2
0
    private void MouseUp(int buttonID, Vector3 position)
    {
        if (!mousePressed || buttonID != 0)
        {
            return;
        }

        if (isCreatingMultipleVoxels)
        {
            lastVoxelCreated.transform.SetParent(null);
            bool canVoxelsBeCreated = true;

            foreach (VoxelPrefab voxel in createdVoxels.Values)
            {
                if (!voxel.IsAvailable())
                {
                    canVoxelsBeCreated = false;
                    break;
                }
            }

            BuildInWorldCompleteAction buildAction = new BuildInWorldCompleteAction();
            buildAction.actionType = BuildInWorldCompleteAction.ActionType.CREATE;

            List <BuilderInWorldEntityAction> entityActionList = new List <BuilderInWorldEntityAction>();

            foreach (Vector3Int voxelPosition in createdVoxels.Keys)
            {
                if (canVoxelsBeCreated)
                {
                    DecentralandEntity entity = builderInWorldEntityHandler.DuplicateEntity(lastVoxelCreated);
                    entity.gameObject.tag = BuilderInWorldSettings.VOXEL_TAG;
                    entity.gameObject.transform.position = voxelPosition;

                    BuilderInWorldEntityAction builderInWorldEntityAction = new BuilderInWorldEntityAction(entity, entity.entityId, BuilderInWorldUtils.ConvertEntityToJSON(entity));
                    entityActionList.Add(builderInWorldEntityAction);
                }
                Destroy(createdVoxels[voxelPosition].gameObject);
            }

            if (!canVoxelsBeCreated)
            {
                builderInWorldEntityHandler.DeleteEntity(lastVoxelCreated);
            }
            else
            {
                buildAction.CreateActionType(entityActionList, BuildInWorldCompleteAction.ActionType.CREATE);
                actionController.AddAction(buildAction);
            }

            createdVoxels.Clear();
            builderInWorldEntityHandler.DeselectEntities();

            lastVoxelCreated         = null;
            isCreatingMultipleVoxels = false;

            mousePressed = false;
            freeCameraMovement.SetCameraCanMove(true);
        }
    }
Example #3
0
    public void EntityDuplicate()
    {
        IDCLEntity duplicateEntity = entityHandler.DuplicateEntity(entity).rootEntity;
        DCLBuilderInWorldEntity convertedEntity = entityHandler.GetConvertedEntity(duplicateEntity);

        Assert.IsNotNull(convertedEntity);
    }