Exemplo n.º 1
0
 void DropItem(int i)
 {
     if (onRightPanel)
     {
         Item newItem = storageView.GetItem();
         gameController.DropItem(newItem, playerUnit.posX, playerUnit.posY);
         storageView.SoftReset();
     }
     else
     {
         if (secondaryStorageView.GetCurrentIndex() == playerUnit.GetLeftIndex() - 4)
         {
             playerUnit.EquipInactive();
             FillUIReset();
         }
         if (secondaryStorageView.GetCurrentIndex() == playerUnit.GetRightIndex() - 4)
         {
             playerUnit.EquipInactive();
             FillUIReset();
         }
         Item newItem = secondaryStorageView.GetItem();
         gameController.DropItem(newItem, playerUnit.posX, playerUnit.posY);
         secondaryStorageView.SoftReset();
     }
 }
Exemplo n.º 2
0
    void ScanForMenuInputs()
    {
        if (Input.GetAxisRaw("MoveNorth") != 0 && canMoveNorth)
        {
            canMoveNorth = false;
            if (onRightPanel)
            {
                storageView.PrevOption();
            }
            else
            {
                secondaryStorageView.PrevOption();
            }
        }
        else if (Input.GetAxisRaw("MoveNorth") == 0)
        {
            canMoveNorth = true;
        }
        if (Input.GetAxisRaw("MoveSouth") != 0 && canMoveSouth)
        {
            canMoveSouth = false;
            if (onRightPanel)
            {
                storageView.NextOption();
            }
            else
            {
                secondaryStorageView.NextOption();
            }
        }
        else if (Input.GetAxisRaw("MoveSouth") == 0)
        {
            canMoveSouth = true;
        }

        if (Input.GetAxisRaw("MoveWest") != 0 && canMoveWest)
        {
            canMoveWest = false;
            SwitchInventoryFocus();
        }
        else if (Input.GetAxisRaw("MoveWest") == 0)
        {
            canMoveWest = true;
        }

        if (Input.GetAxisRaw("MoveEast") != 0 && canMoveEast)
        {
            canMoveEast = false;
            SwitchInventoryFocus();
        }
        else if (Input.GetAxisRaw("MoveEast") == 0)
        {
            canMoveEast = true;
        }

        if (Input.GetAxisRaw("OpenInventory") != 0 && canOpenInventory)
        {
            CloseInventory();
            canOpenInventory = false;
        }
        else if (Input.GetAxisRaw("OpenInventory") == 0)
        {
            canOpenInventory = true;
        }
        if (Input.GetAxisRaw("Drop") != 0 && canDrop)
        {
            if (onRightPanel)
            {
                DropItem(storageView.GetCurrentIndex());
            }
            else
            {
                DropItem(secondaryStorageView.GetCurrentIndex());
            }
            canDrop = false;
        }
        else if (Input.GetAxisRaw("Drop") == 0)
        {
            canDrop = true;
        }
        if (Input.GetAxisRaw("Search") != 0 && canSearch)
        {
            //searchMode = true;
            CloseInventory();
            inputMode = InputModes.search;
            canSearch = false;
        }
        else if (Input.GetAxisRaw("Search") == 0)
        {
            canSearch = true;
        }
        if (Input.GetAxisRaw("Swap") != 0 && canSwap)
        {
            canSwap = false;
            if (onRightPanel)
            {
                secondaryStorageView.AddItem(storageView.GetItem());
                storageView.SoftReset();
                secondaryStorageView.SoftReset();
            }
            else
            {
                storageView.AddItem(secondaryStorageView.GetItem());
                storageView.SoftReset();
                secondaryStorageView.SoftReset();
            }
        }
        else if (Input.GetAxisRaw("Swap") == 0)
        {
            canSwap = true;
        }
    }