示例#1
0
    public void MouseEnterItem(BoxScrollableItem item)
    {
        string itemName      = string.Empty;
        string initialString = string.Empty;

        Box.PackagedBud     possibleBud     = item.GetBud();
        Box.PackagedProduct possibleProduct = item.GetProduct();
        bool productSelected = false;

        if (possibleBud != null)
        {
            itemName  = possibleBud.weight + "g of ";
            itemName += possibleBud.strain.name;
            if (possibleBud.selected)
            {
                productSelected = true;
            }
        }
        else if (possibleProduct != null)
        {
            itemName = possibleProduct.productReference.productName;
            if (possibleProduct.selected)
            {
                productSelected = true;
            }
        }
        if (productSelected)
        {
            titleText.text = "Click to deselect " + itemName;
        }
        else
        {
            titleText.text = "Click to select " + itemName;
        }
    }
示例#2
0
 public void MouseClickItem(BoxScrollableItem item)
 {
     Box.PackagedBud bud = item.GetBud();
     if (bud != null)
     {
         if (bud.selected)
         {
             productManager.DeselectProduct(bud);
         }
         else
         {
             productManager.SelectProduct(bud);
         }
     }
     Box.PackagedProduct packagedProduct = item.GetProduct();
     if (packagedProduct != null)
     {
         if (packagedProduct.selected)
         {
             productManager.DeselectProduct(packagedProduct);
         }
         else
         {
             productManager.SelectProduct(packagedProduct);
             print(packagedProduct.productReference);
             print(packagedProduct.productReference.color);
         }
     }
 }
示例#3
0
    public BoxProductReturnResults BoxPackagedProduct(Order.Order_Product productOrder)
    {
        int singleWeight       = productOrder.GetProduct().boxWeight;
        int productOrderWeight = productOrder.GetQuantity() * singleWeight;
        Box currentBox         = CreateBox(productOrderWeight);

        Box.PackagedProduct newPackagedProduct = new Box.PackagedProduct(currentBox, productOrder.GetProduct(), productOrder.GetQuantity());
        //currentBox.AddProduct(newPackagedProduct);
        float randomRed   = UnityEngine.Random.value;
        float randomGreen = UnityEngine.Random.value;
        float randomBlue  = UnityEngine.Random.value;

        if (productOrderWeight > currentBox.maxWeight)
        {
            int difference = currentBox.maxWeight - productOrderWeight;
            int val        = difference / singleWeight;
            val = Mathf.Abs(val);

            Order.Order_Product leftoverOrder = new Order.Order_Product(val, newPackagedProduct.productReference);
            newPackagedProduct.quantity -= val;
            currentBox.AddProduct(newPackagedProduct);
            return(new BoxProductReturnResults(currentBox, leftoverOrder));
        }
        else
        {
            currentBox.AddProduct(newPackagedProduct);
            return(new BoxProductReturnResults(currentBox, null));
        }
    }
    IEnumerator StartMovingNextPackagedProduct()
    {
        yield return(new WaitForSeconds(.01f));

        if (currentProduct != null)
        {
            if (currentProduct.currentProduct != null)
            {
                print(currentProduct.currentProduct.GetName());
                try
                {
                    Box.PackagedProduct packagedProduct = (Box.PackagedProduct)currentProduct.currentProduct;
                    if (packagedProduct != null)
                    {
                        int newQuantity = packagedProduct.quantity - 1;
                        print("New quantity: " + newQuantity);
                        if (newQuantity > 0)
                        {
                            print("Starting to move next");
                            StartCoroutine(MoveNextProduct());
                            yield break;
                        }
                        else
                        {
                            packagedProduct.parentBox.RemoveProduct(packagedProduct);
                            uiM_v5.leftBarMainSelectionsPanel.RemoveProduct(currentProduct.currentProduct, true);
                            if (moveMode == MoveMode.single)
                            {
                                currentProduct.currentPlaceholder = null;
                                StopMovingAllProducts(false);
                                yield break;
                            }
                            else if (moveMode == MoveMode.multiple)
                            {
                                yield break;
                            }
                        }
                    }
                }
                catch (System.InvalidCastException)
                {
                    if (moveMode == MoveMode.single)
                    {
                        StopMovingAllProducts(false);
                        yield break;
                    }
                    else if (moveMode == MoveMode.multiple)
                    {
                        print("Improper: Multiple - needs attention");
                        yield break;
                    }
                    yield break;
                }
            }
        }
        print("Error: reached end");
        StopMovingAllProducts(false);
    }
示例#5
0
    public void AddStartBox()
    {
        List <StoreObjectReference> boxModels = db.GetProducts(StoreObjectReference.productType.box);
        GameObject box       = Instantiate(boxModels[1].gameObject_);
        ProductGO  productGO = box.GetComponent <ProductGO>();

        productGO.objectID = boxModels[1].objectID;
        StorageBox storageBox = new StorageBox(boxModels[1], box);

        storageBox.uniqueID              = Dispensary.GetUniqueProductID();
        storageBox.objectID              = boxModels[1].objectID;
        productGO.product                = storageBox;
        productGO.canHighlight           = true;
        box.GetComponent <Box>().product = storageBox;
        List <Product> toAdd = new List <Product>();
        List <StoreObjectReference> bongs = db.GetProducts(StoreObjectReference.productType.glassBong);

        // Add bongs to box

        /*for (int i = 0; i < 4; i++)
         * {
         *  GameObject bongGO = Instantiate(bongs[0].gameObject_);
         *  bongGO.GetComponent<Glass>().height = 16f;
         *  ProductGO productGO_ = bongGO.GetComponent<ProductGO>();
         *  productGO_.objectID = bongs[0].objectID;
         *  Bong newBong = new Bong(bongGO);
         *  newBong.parentProduct = storageBox;
         *  newBong.objectID = bongs[0].objectID;
         *  productGO_.product = newBong;
         *  productGO_.canHighlight = false;
         *  bongGO.gameObject.SetActive(false);
         *  toAdd.Add(newBong);
         *  box.GetComponent<Box>().AddProduct(newBong);
         * }
         * storageBox.AddProducts(toAdd);*/
        Box parentBox = box.GetComponent <Box>();

        Box.PackagedProduct newPackagedProduct = new Box.PackagedProduct(parentBox, bongs[4], 8);
        parentBox.AddProduct(newPackagedProduct);

        Strain toUse = db.GetStrain("Trainwreck");

        // Temp add bud to starting box.  eventually will contain pipes, bowls, and rolling papers to start
        Box.PackagedBud newBud = new Box.PackagedBud(parentBox, toUse, 88);
        parentBox.AddBud(newBud);

        ShelfPosition boxPosition = dm.dispensary.Storage_cs[0].GetRandomStorageLocation(storageBox);

        box.transform.position = boxPosition.transform.position;
        box.transform.parent   = boxPosition.transform;
        boxPosition.shelf.parentShelf.AddProduct(storageBox);
    }
    public int CheckAgainstList(StoreObjectReference reference)
    {
        int toReturn = -1;

        for (int i = 0; i < products.Count; i++)
        {
            Box.PackagedProduct packagedProduct = products[i];
            if (packagedProduct.productReference.objectID == reference.objectID)
            {
                int tempIndex = i;
                return(tempIndex);
            }
        }
        return(toReturn);
    }
    public GameObject CreatePlaceholder(CurrentProduct needsPlaceholder)
    {
        Product product     = needsPlaceholder.currentProduct;
        Color   toUse       = Color.white;
        bool    assignColor = false;

        if (product != null)
        {
            GameObject toInstantiate = null;
            try
            {
                toInstantiate = product.productGO;
                if (toInstantiate == null)
                { // product go was null, throw exception
                    throw new System.NullReferenceException();
                }
            }
            catch (System.NullReferenceException)
            {
                if (product.productType == Product.type_.packagedBud)
                {
                    if (needsPlaceholder.currentContainer == null)
                    {
                        StoreObjectReference budPlaceholder = dm.database.GetProduct("Bud Placeholder");
                        toInstantiate = budPlaceholder.gameObject_;
                    }
                    else
                    {
                        toInstantiate = needsPlaceholder.currentContainer.gameObject_;
                    }
                }
                if (product.productType == Product.type_.packagedProduct)
                {
                    Box.PackagedProduct packagedProduct = (Box.PackagedProduct)product;
                    if (packagedProduct != null)
                    {
                        toInstantiate = packagedProduct.productReference.gameObject_;
                        toUse         = product.productReference.color.GetColor_PackagedProduct();
                        assignColor   = true;
                    }
                }
            }
            if (product.IsBox())
            {
                StorageBox storageBox = (StorageBox)product;
                Box        box        = storageBox.box.GetComponent <Box>();
                if (box.parentBoxStack != null)
                {
                    Box boxToMove = box.parentBoxStack.StartRemovingBox(needsPlaceholder, box.product.uniqueID);
                    if (boxToMove.GetComponent <Placeholder>() == null)
                    {
                        boxToMove.gameObject.AddComponent <Placeholder>();
                    }
                    storageBox.box    = boxToMove.gameObject;
                    boxToMove.product = storageBox;
                    return(boxToMove.gameObject);
                }
                else if (storageBox != null)
                {
                    Box         placeholderBox = Instantiate(storageBox.box.GetComponent <Box>());
                    BoxCollider collider       = placeholderBox.GetComponent <BoxCollider>();
                    collider.enabled = false;
                    StorageBox newStorageBox = new StorageBox(storageBox.productReference, placeholderBox.gameObject);
                    newStorageBox.uniqueID = storageBox.uniqueID;
                    placeholderBox.product = newStorageBox;
                    if (placeholderBox.GetComponent <Placeholder>() == null)
                    {
                        placeholderBox.gameObject.AddComponent <Placeholder>();
                    }
                    return(placeholderBox.gameObject);
                }
                else
                {
                    //print("Falling through");
                }
            }
            if (toInstantiate != null)
            {
                //print("Something exists to be instantiated");
                GameObject newPlaceholderGO = Instantiate(toInstantiate);
                //print("1");
                if (newPlaceholderGO.GetComponent <Placeholder>() == null)
                {
                    newPlaceholderGO.AddComponent <Placeholder>();
                }
                Placeholder newPlaceholder = newPlaceholderGO.GetComponent <Placeholder>();
                newPlaceholder.parentProduct      = needsPlaceholder;
                currentProduct.currentPlaceholder = newPlaceholder;
                if (product.productType == Product.type_.packagedBud)
                {
                    /*if (needsPlaceholder.currentContainer == null)
                     * {
                     *  newPlaceholder.NoContainerToggle();
                     * }
                     * else
                     * {
                     *  newPlaceholder.HasContainerToggle();
                     * }
                     */
                }

                // Apply product color
                if (assignColor)
                {
                    newPlaceholderGO = ApplyColor(newPlaceholderGO, toUse);
                }

                /*ProductGO productGO = currentProduct.GetComponent<ProductGO>();
                 * if (productGO != null)
                 * {
                 *  if (productGO.product != null)
                 *  {
                 *      if (productGO.product.productReference != null)
                 *      {
                 *          StoreObjectReference reference = productGO.product.productReference;
                 *          if (reference != null)
                 *          {
                 *              if (reference.color.colorIsAssigned)
                 *              {
                 *                  try
                 *                  {
                 *                      newPlaceholderGO = ApplyColor(newPlaceholderGO, reference.color.GetColor());
                 *                  }
                 *                  catch (System.ArgumentException)
                 *                  {
                 *                      print("Color was marked as being assigned, but wasnt there");
                 *                  }
                 *              }
                 *          }
                 *      }
                 *  }
                 * }*/

                return(newPlaceholderGO); // needsPlaceholder.currentPlaceholder = newPlaceholder.GetComponent<Placeholder>();
            }
            else
            {
                print("The object to instantiate is null: " + product.GetName());
                return(null);
            }
        }
        else
        {
            print("Returning null");
            return(null);
        }
    }
    IEnumerator MoveProduct()
    {
        while (true)
        {
            currentDisplayShelf = null;
            currentShelf        = null;
            bool movementConflict = false;
            if (currentProduct != null)
            {
                // Raise or lower shelf layer
                if (Input.GetKeyUp(dm.database.settings.GetRaiseShelfLayer()))
                {
                    SetCurrentShelfLayer(currentShelfLayer + 1);
                }
                if (Input.GetKeyUp(dm.database.settings.GetLowerShelfLayer()))
                {
                    SetCurrentShelfLayer(currentShelfLayer - 1);
                }

                // If moving a box
                bool productIsBox = currentProduct.currentProduct.IsBox();
                if (productIsBox)
                { // Moving box
                    print("Moving box");
                }
                if (currentProduct.newStack != null)
                {
                    currentProduct.newStack.CancelAddingBox();
                    currentProduct.newStack = null;
                    if (currentProduct.currentPlaceholder != null)
                    {
                        currentProduct.currentPlaceholder.gameObject.SetActive(true);
                    }
                }

                bool chooseContainerPanelOpen = uiM_v5.chooseContainerPanel.panelOpen;
                bool placingBudPanelOpen      = uiM_v5.packagedBudPlacementPanel.panelOpen;
                // Raycasting
                Ray          ray  = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit[] hits = Physics.RaycastAll(ray.origin, ray.direction);

                if (currentProduct.currentProduct.NeedsContainer())
                {
                    if (Input.GetKeyUp(dm.database.settings.GetOpenChooseContainerPanel().ToLower()))
                    {
                        if (chooseContainerPanelOpen)
                        {
                            uiM_v5.CloseChooseContainerPanel();
                        }
                        else
                        {
                            currentProduct.currentPlaceholder.indicator.OpenChooseContainerPanel(currentProduct);
                        }
                    }
                }
                if (chooseContainerPanelOpen || placingBudPanelOpen)
                {
                    // Dont carry on if either of these windows are open
                    yield return(null);
                }
                else if (currentProduct.currentPlaceholder != null)
                {
                    currentProduct.currentPlaceholder.GetComponent <BoxCollider>().enabled = false;
                    currentProduct.currentPlaceholder.HighlightOff();
                    bool hitShelf = false;
                    foreach (RaycastHit hit in hits)
                    {
                        if (hit.transform.tag == "DisplayShelf" || hit.transform.tag == "CheckoutCounter")
                        {
                            if (hit.transform.tag == "DisplayShelf")
                            {
                                SetCurrentDisplayShelf(hit.transform.gameObject.GetComponent <StoreObjectFunction_DisplayShelf>());
                            }
                            else if (hit.transform.tag == "CheckoutCounter")
                            {
                                StoreObjectFunction_DisplayShelf shelf = hit.transform.gameObject.GetComponent <StoreObjectFunction_DisplayShelf>();
                                if (shelf != null)
                                {
                                    SetCurrentDisplayShelf(shelf);
                                }
                                else
                                {
                                    hitShelf = false;
                                    break;
                                }
                            }
                        }
                        if (hit.transform.gameObject.layer == 21)
                        {
                            currentShelf = hit.transform.gameObject.GetComponent <Shelf>();
                            if (currentShelf.shelfLayer == GetCurrentShelfLayer())
                            {
                                hitShelf = true;
                                currentProduct.currentPlaceholder.transform.position = hit.point;
                            }
                            SetCurrentDisplayShelf(currentShelf.parentShelf);
                        }
                        if (hit.transform.gameObject.layer == 17)
                        {
                            //print("Hitting product");
                        }
                        if (hit.transform.tag == "StorageBox" && productIsBox)
                        {
                            Box        beingMoved           = currentProduct.currentPlaceholder.GetComponent <Box>();
                            StorageBox storageBoxBeingMoved = (StorageBox)beingMoved.product;
                            Box        hitBox = hit.transform.GetComponent <Box>();
                            if (hitBox != null)
                            {
                                BoxStack stack = hitBox.parentBoxStack;
                                if (stack != null)
                                {
                                    if (stack.boxList.Count <= 2)
                                    {
                                        currentProduct.newStack = stack;
                                        Box        toSend        = Instantiate(beingMoved);
                                        StorageBox newStorageBox = new StorageBox(storageBoxBeingMoved.productReference, toSend.gameObject);
                                        newStorageBox.uniqueID = storageBoxBeingMoved.uniqueID;
                                        toSend.product         = newStorageBox;
                                        currentProduct.newStack.StartAddingBox(toSend);
                                        beingMoved.gameObject.SetActive(false);
                                        // need to handle carrying across contents as well
                                    }
                                    else
                                    {
                                        // Stack is full
                                        stack.gameObject.GetComponent <Highlighter>().ConstantOnImmediate(Color.red);
                                    }
                                }
                                else
                                {
                                    print("Need to create a new stack");
                                }
                            }
                        }
                    }
                    if (!hitShelf && hits.Length > 0 && !productIsBox)
                    { // Find the nearest display shelf
                        try
                        {
                            currentDisplayShelf = GetClosestDisplayShelf(hits[0].point);
                            currentShelf        = currentDisplayShelf.GetShelf(GetCurrentShelfLayer(), hits[0].point);
                            Vector3 closestPoint = currentShelf.GetCollider().ClosestPoint(hits[0].point);
                            currentProduct.currentPlaceholder.transform.position = closestPoint;
                        }
                        catch (System.NullReferenceException)
                        {
                            // Failed to find a nearby shelf
                        }
                    }
                    else if (!hitShelf && hits.Length > 0 && productIsBox)
                    {
                        try
                        {
                            RaycastHit       toUse          = hits[0];
                            bool             outdoorHit     = false;
                            ComponentSubGrid closestSubGrid = dm.dispensary.GetClosestSubGrid(toUse.point);
                            ComponentGrid    grid           = closestSubGrid.parentGrid;
                            FloorTile        hitTile        = null;
                            foreach (RaycastHit hit in hits)
                            {
                                if (hit.transform.tag == "Floor")
                                {
                                    hitTile = hit.transform.GetComponent <FloorTile>();
                                }
                            }
                            if (hitTile != null)
                            {
                                outdoorHit = false;
                            }
                            else
                            {
                                outdoorHit = true;
                            }
                            ComponentNode nodeToSnapTo    = null;
                            GameObject    tempTileGO      = Instantiate(dm.database.GetFloorTile(10000).gameObject_);
                            BoxCollider   placeholderTile = tempTileGO.GetComponent <BoxCollider>();
                            if (hitTile != null)
                            {
                                outdoorHit   = false;
                                nodeToSnapTo = hitTile.node;
                            }
                            if (nodeToSnapTo == null)
                            {
                                nodeToSnapTo = GetClosestEdgeNode(grid, toUse, outdoorHit);
                            }
                            Vector3 snapPos = nodeToSnapTo.worldPosition;
                            Vector3 newPos  = new Vector3(snapPos.x, snapPos.y + placeholderTile.bounds.extents.y, snapPos.z);
                            if (!dm.actionManager.snapToGrid)
                            { // If not snapping to grid and didnt hit something outside
                                if (!outdoorHit)
                                {
                                    foreach (RaycastHit hit in hits)
                                    {
                                        if (hit.transform.tag == "Floor")
                                        {
                                            newPos = hit.point;
                                        }
                                    }
                                }
                            }
                            currentProduct.currentPlaceholder.transform.position = newPos;
                            Destroy(tempTileGO.gameObject);
                        }
                        catch (System.NullReferenceException)
                        {
                        }
                    }
                    if (currentDisplayShelf != null && currentShelf != null)
                    {
                        // Disable Colliders
                        currentDisplayShelf.GetComponent <BoxCollider>().enabled = false;
                        currentShelf.GetCollider().enabled = false;

                        // Perform collision check
                        BoxCollider productCollider = currentProduct.currentPlaceholder.GetComponent <BoxCollider>();
                        productCollider.enabled = true;
                        Vector3 size = productCollider.bounds.size; // /14
                        //Vector3 center = productCollider.bounds.center;
                        productCollider.enabled = false;
                        //size.x = Mathf.Abs(size.x);
                        //size.y = Mathf.Abs(size.y);
                        //size.z = Mathf.Abs(size.z);
                        //float oldY = size.y;
                        //size.y = size.z;
                        //size.z = oldY;
                        Vector3    center  = new Vector3(productCollider.transform.position.x, productCollider.transform.position.y + size.y / 2, productCollider.transform.position.z);
                        Collider[] results = Physics.OverlapBox(center, size / 2);

                        if (results.Length > 0)
                        {
                            //print(results.Length);
                            bool conflict = true;

                            /*foreach (Collider col in results)
                             * {
                             *  if (col.tag == "Shelf")
                             *  {
                             *      print("COnflict with shelf 1");
                             *      conflict = true;
                             *      break;
                             *  }
                             *  else if (col.gameObject.layer == 21)
                             *  { // Shelf layer
                             *      print("COnflict with shelf 2");
                             *      conflict = true;
                             *      break;
                             *  }
                             *  else if (col.gameObject.layer == 17)
                             *  { // Product layer
                             *      print("COnflict with product");
                             *      conflict = true;
                             *      break;
                             *  }
                             * }*/
                            if (conflict)
                            {
                                movementConflict = true;
                                currentProduct.currentPlaceholder.HighlightOn(Color.red);
                            }
                            results = null;
                        }

                        // Re-enable colliders
                        currentDisplayShelf.GetComponent <BoxCollider>().enabled = true;
                        currentShelf.GetCollider().enabled = true;
                    }
                    else
                    {
                        //print("Didnt check");
                    }
                    currentProduct.currentPlaceholder.GetComponent <BoxCollider>().enabled = true;
                }
                else
                {
                    print("Placeholder doesnt exist");
                }
                if (Input.GetMouseButtonUp(0) && !dm.PointerOverUI)
                { // Left Click
                    if (!movementConflict)
                    {
                        if (currentProduct.currentProduct.NeedsContainer())
                        {
                            if (currentProduct.currentContainer != null)
                            {
                                Box.PackagedBud packagedBud = currentProduct.GetPackagedBud();
                                if (packagedBud != null)
                                {
                                    currentProduct.currentPlaceholder.indicator.OpenPackagedBudPlacementPanel(currentProduct.currentContainer, packagedBud);
                                }
                            }
                            else
                            {
                                currentProduct.currentPlaceholder.indicator.OpenChooseContainerPanel(currentProduct);
                            }
                        }
                        else if (!productIsBox)
                        {
                            Box.PackagedProduct packagedProduct = null;
                            bool isPackagedProduct = false;
                            try
                            {
                                packagedProduct   = (Box.PackagedProduct)currentProduct.currentProduct;
                                isPackagedProduct = true;
                            }
                            catch (System.InvalidCastException)
                            { // Wasnt a packaged product
                                // Do nothing, allow to carry on
                                isPackagedProduct = false;
                            }
                            if (isPackagedProduct)
                            {
                                if (packagedProduct != null)
                                {
                                    packagedProduct.MoveProduct(Dispensary.JobType.StoreBudtender, currentProduct.currentPlaceholder.transform.position, currentDisplayShelf);
                                    currentProduct.FinishMovement();

                                    // Try moving next packaged product
                                    StartCoroutine(StartMovingNextPackagedProduct());
                                    yield return(new WaitForSeconds(.0125f)); // Needs to last longer than the waitforseconds(.01f)

                                    packagedProduct.parentBox.RemoveProduct(packagedProduct);
                                    uiM_v5.leftBarMainSelectionsPanel.UpdateBoxScrollable();
                                    yield break;

                                    /*Product newProduct = null;
                                     * CurrentProduct oldProduct = currentProduct;
                                     * try
                                     * { // Use packaged product reference
                                     *  newProduct = CreateProduct(packagedProduct.packagedProductReference, packagedProduct.parentBox.transform.position);
                                     * }
                                     * catch (System.NullReferenceException)
                                     * { // Use product reference
                                     *  newProduct = CreateProduct(packagedProduct.productReference, packagedProduct.parentBox.transform.position);
                                     * }
                                     * if (newProduct != null)
                                     * {
                                     *  newProduct.productGO.gameObject.SetActive(false);
                                     *  newProduct.MoveProduct(Dispensary.JobType.StoreBudtender, currentProduct.currentPlaceholder.transform.position, currentDisplayShelf);
                                     *  currentProduct.currentProduct.uniqueID = newProduct.uniqueID;
                                     *  currentProduct.FinishMovement();
                                     *
                                     *  // Try moving next packaged product
                                     *  StartCoroutine(StartMovingNextPackagedProduct());
                                     *  yield return new WaitForSeconds(.0125f); // Needs to last longer than the waitforseconds(.01f)
                                     *  packagedProduct.parentBox.RemoveProduct(packagedProduct);
                                     *  uiM_v5.leftBarMainSelectionsPanel.UpdateBoxScrollable();
                                     *  yield break;
                                     * }*/
                                }
                            }
                            else
                            { // Is not a packaged product0
                                currentProduct.currentProduct.MoveProduct(Dispensary.JobType.StoreBudtender, currentProduct.currentPlaceholder.transform.position, currentDisplayShelf);

                                uiM_v5.leftBarMainSelectionsPanel.RemoveProduct(currentProduct.currentProduct, false);
                                if (moveMode == MoveMode.single)
                                {
                                    FinishedMovingSingleProduct();
                                }
                                else if (moveMode == MoveMode.multiple)
                                {
                                    FinishedMovingMultipleProducts();
                                }
                                yield break;
                            }
                        }
                        else if (productIsBox)
                        {
                            bool       newStackExists = false;
                            StorageBox beingMoved     = (StorageBox)currentProduct.currentProduct;
                            if (currentProduct.newStack != null)
                            {
                                newStackExists = true;
                            }
                            if (newStackExists)
                            {
                                beingMoved.MoveProduct(Dispensary.JobType.StoreBudtender, currentProduct.currentPlaceholder.transform.position, currentProduct.newStack);
                            }
                            else if (currentDisplayShelf != null)
                            {
                                beingMoved.MoveProduct(Dispensary.JobType.StoreBudtender, currentProduct.currentPlaceholder.transform.position, currentDisplayShelf);
                            }
                        }
                    }
                    else
                    {
                        print("Cant move here: wont fit");
                    }
                }
            }
            yield return(null);
        }
    }
示例#9
0
 public StoredProduct(Box.PackagedProduct packagedProduct)
 {
     product  = packagedProduct;
     quantity = packagedProduct.quantity;
 }