Ejemplo n.º 1
0
    public BoxStack CreateStackPlaceholder(int ignoreIndex)
    {
        GameObject newPlaceholderStack = new GameObject("Placeholder Stack");
        BoxStack   newStack            = newPlaceholderStack.AddComponent <BoxStack>();

        if (boxList.Count > 0)
        {
            newPlaceholderStack.transform.position = boxList[0].transform.position;
            for (int i = 0; i < boxList.Count; i++)
            {
                int        temp          = i;
                Box        currentBox    = boxList[temp];
                StorageBox parentProduct = (StorageBox)currentBox.product;
                boxList[i].product.PlayCloseAnimation();
                if (i != ignoreIndex)
                {
                    Box newBox = Instantiate(boxList[i]);
                    parentProduct.box = newBox.gameObject;
                    newBox.product    = parentProduct;
                    //newBoxObject.product.PlayCloseAnimation();
                    if (newBox.GetComponent <Placeholder>() == null)
                    {
                        newBox.gameObject.AddComponent <Placeholder>();
                    }
                    newStack.AddBox(newBox);
                }
            }
        }
        newStack.SortStack(newStack.transform.position, true, false);
        return(newStack);
    }
    public bool DropStack()
    {
        action = DriverAction.goingToGetStack;
        currentStack.handTruck = null;
        currentStack.SetParent(null);
        currentStack.SortStack(currentStack.boxStackPosition, true, true);
        currentStack.droppedOff = true;
        dm.dispensary.inventory.AddLooseBoxStack(currentStack);

        /*foreach (Box box in currentStack.boxList)
         * {
         *  StorageBox storageBox = (StorageBox)box.product;
         *  dm.dispensary.inventory.AddLooseBox(storageBox);
         * }*/
        dm.dispensary.inventory.RefreshInventoryList(false);
        handTruck.Tip(true);
        NextAction();
        return(true);
    }
Ejemplo n.º 3
0
    public BoxStack CreateStackPlaceholder_IncreasedSize(Box newBox)
    {
        List <Box> tempBoxList = new List <Box>();

        foreach (Box box in boxList)
        {
            tempBoxList.Add(box);
        }
        tempBoxList.Add(newBox);
        tempBoxList.Sort(SortBoxes);
        GameObject newPlaceholderStack = new GameObject("Placeholder Stack");
        BoxStack   newStack            = newPlaceholderStack.AddComponent <BoxStack>();

        if (tempBoxList.Count > 0)
        {
            newPlaceholderStack.transform.position = tempBoxList[0].transform.position;
            for (int i = 0; i < tempBoxList.Count; i++)
            {
                int        temp          = i;
                Box        currentBox    = tempBoxList[temp];
                StorageBox parentProduct = (StorageBox)currentBox.product;
                Box        newBoxObject  = Instantiate(tempBoxList[i]);
                parentProduct.box    = newBoxObject.gameObject;
                newBoxObject.product = parentProduct;
                newBoxObject.gameObject.SetActive(true);
                //newBoxObject.product.PlayCloseAnimation();
                if (newBox.GetComponent <Placeholder>() == null)
                {
                    newBox.gameObject.AddComponent <Placeholder>();
                }
                newStack.AddBox(newBoxObject);
            }
        }
        newStack.SortStack(newStack.transform.position, true, false);
        Destroy(newBox.gameObject); // destory box that was originally sent
        return(newStack);
    }
Ejemplo n.º 4
0
 public void LoadBoxes(BoxStack newStack)
 {
     boxStack = newStack;
     boxStack.SortStack(boxSnapPos.transform.position, true, false);
 }