Esempio n. 1
0
    public void UndoEditionGOLastStep()
    {
        if (undoGO == null || editionGO == null)
        {
            return;
        }

        BuilderInWorldUtils.CopyGameObjectStatus(undoGO, editionGO, false, false);
    }
Esempio n. 2
0
    public DCLBuilderInWorldEntity DuplicateEntity(DCLBuilderInWorldEntity entityToDuplicate)
    {
        IDCLEntity entity = SceneUtils.DuplicateEntity(sceneToEdit, entityToDuplicate.rootEntity);

        BuilderInWorldUtils.CopyGameObjectStatus(entityToDuplicate.gameObject, entity.gameObject, false, false);
        DCLBuilderInWorldEntity convertedEntity = SetupEntityToEdit(entity);

        NotifyEntityIsCreated(entity);
        EntityListChanged();
        return(convertedEntity);
    }
    public override void SelectedEntity(DCLBuilderInWorldEntity selectedEntity)
    {
        base.SelectedEntity(selectedEntity);

        initialRotation = editionGO.transform.rotation;

        SetObjectIfSnapOrNot();

        currentYRotationAdded = 0;
        BuilderInWorldUtils.CopyGameObjectStatus(editionGO, snapGO, false);
    }
Esempio n. 4
0
    public DecentralandEntity DuplicateEntity(DCLBuilderInWorldEntity entityToDuplicate)
    {
        DecentralandEntity entity = sceneToEdit.DuplicateEntity(entityToDuplicate.rootEntity);

        BuilderInWorldUtils.CopyGameObjectStatus(entityToDuplicate.gameObject, entity.gameObject, false, false);
        SetupEntityToEdit(entity);

        NotifyEntityIsCreated(entity);
        EntityListChanged();
        return(entity);
    }
    void LateUpdate()
    {
        if (selectedEntities.Count <= 0 || isMultiSelectionActive)
        {
            return;
        }

        if (isSnapActive)
        {
            if (snapObjectAlreadyMoved)
            {
                Vector3 objectPosition = snapGO.transform.position;
                Vector3 eulerRotation  = snapGO.transform.rotation.eulerAngles;

                float currentSnapFactor = snapFactor;

                objectPosition.x = Mathf.RoundToInt(objectPosition.x / currentSnapFactor) * currentSnapFactor;
                objectPosition.y = Mathf.RoundToInt(objectPosition.y / currentSnapFactor) * currentSnapFactor;
                objectPosition.z = Mathf.RoundToInt(objectPosition.z / currentSnapFactor) * currentSnapFactor;
                eulerRotation.y  = snapRotationDegresFactor * Mathf.FloorToInt((eulerRotation.y % snapRotationDegresFactor));

                Quaternion destinationRotation = Quaternion.AngleAxis(currentYRotationAdded, Vector3.up);
                editionGO.transform.rotation = initialRotation * destinationRotation;
                editionGO.transform.position = objectPosition;
            }
            else if (Vector3.Distance(snapGO.transform.position, editionGO.transform.position) >= snapDistanceToActivateMovement)
            {
                BuilderInWorldUtils.CopyGameObjectStatus(editionGO, snapGO, false);


                snapObjectAlreadyMoved = true;
                SetEditObjectParent();
            }
        }
        else
        {
            Vector3 pointToLookAt = Camera.main.transform.position;
            pointToLookAt.y = editionGO.transform.position.y;
            Quaternion lookOnLook = Quaternion.LookRotation(editionGO.transform.position - pointToLookAt);
            freeMovementGO.transform.rotation = lookOnLook;
        }
    }
Esempio n. 6
0
    public virtual void SelectedEntity(DCLBuilderInWorldEntity selectedEntity)
    {
        CenterGameObjectToEdit();

        BuilderInWorldUtils.CopyGameObjectStatus(editionGO, undoGO, false, false);
    }
 public void UndoSelection()
 {
     BuilderInWorldUtils.CopyGameObjectStatus(undoGO, editionGO, false, false);
     builderInWorldEntityHandler.DeselectEntities();
 }
 public void UndoEditionGOLastStep()
 {
     BuilderInWorldUtils.CopyGameObjectStatus(undoGO, editionGO, false, false);
 }