Ejemplo n.º 1
0
    public void SwapCell(ref CellData selectedCell)
    {
        CellData tempTransition = new CellData(index, itemData, defaultIcon, cellType, stackAmount);

        tempTransition.dataUpdate = dataUpdate;

        AssignItem(selectedCell.itemData, selectedCell.stackAmount);
        selectedCell.AssignItem(tempTransition.itemData, tempTransition.stackAmount);
    }
Ejemplo n.º 2
0
    public void ExchangeGoods(ref CellData currentCell, ref CellData previousCell)
    {
        if (HasSameData(currentCell.itemData) && itemData.isStackable)
        {
            int newStackAmount = stackAmount + currentCell.stackAmount;

            if (newStackAmount > currentCell.itemData.stackAmount)
            {
                previousCell.AssignItem(currentCell.itemData, currentCell.stackAmount);
                SwapCell(ref currentCell);
            }
            else
            {
                AssignDataToCell(ref currentCell, ref previousCell);
            }
        }
        else
        {
            previousCell.AssignItem(currentCell.itemData, currentCell.stackAmount);
            SwapCell(ref currentCell);
        }
    }