Exemplo n.º 1
0
    public BIWEntity CreateCatalogItem(CatalogItem catalogItem, Vector3 startPosition, bool autoSelect = true, bool isFloor = false, Action <IDCLEntity> onFloorLoadedAction = null)
    {
        if (catalogItem.IsNFT() && BIWNFTController.i.IsNFTInUse(catalogItem.id))
        {
            return(null);
        }

        IsInsideTheLimits(catalogItem);

        //Note (Adrian): This is a workaround until the mapping is handle by kernel
        AddSceneMappings(catalogItem);

        Vector3 editionPosition = modeController.GetCurrentEditionPosition();

        BIWEntity entity = entityHandler.CreateEmptyEntity(sceneToEdit, startPosition, editionPosition, false);

        entity.isFloor = isFloor;
        entity.SetRotation(Vector3.zero);

        if (!isFloor)
        {
            CreateLoadingObject(entity);
        }

        entity.rootEntity.OnShapeUpdated += (entity) => onFloorLoadedAction?.Invoke(entity);
        AddShape(catalogItem, entity);

        AddEntityNameComponent(catalogItem, entity);

        AddLockedComponent(entity);

        if (catalogItem.IsSmartItem())
        {
            AddSmartItemComponent(entity);
        }

        if (catalogItem.IsVoxel())
        {
            entity.isVoxel = true;
        }

        if (autoSelect)
        {
            entityHandler.DeselectEntities();
            entityHandler.Select(entity.rootEntity);
        }

        entity.rootEntity.gameObject.transform.eulerAngles = Vector3.zero;

        modeController.CreatedEntity(entity);

        lastCatalogItemCreated = catalogItem;

        entityHandler.EntityListChanged();
        entityHandler.NotifyEntityIsCreated(entity.rootEntity);
        OnInputDone?.Invoke();
        OnCatalogItemPlaced?.Invoke();
        return(entity);
    }
Exemplo n.º 2
0
 public void CreateLastCatalogItem()
 {
     if (lastCatalogItemCreated != null)
     {
         if (entityHandler.IsAnyEntitySelected())
         {
             entityHandler.DeselectEntities();
         }
         OnCatalogItemSelected(lastCatalogItemCreated);
         OnInputDone?.Invoke();
     }
 }
Exemplo n.º 3
0
 public virtual void InputDone()
 {
     OnInputDone?.Invoke();
 }
 private void InputDone() { OnInputDone?.Invoke(); }