Beispiel #1
0
    private void Update()
    {
        if (GameManager.instance.IsPause)
        {
            return;
        }


        for (int i = 1; i < 10; i++)
        {
            if (Input.GetKeyDown(i.ToString()))
            {
                if (current != i - 1)
                {
                    SelectPowerUp(i - 1);
                }
                ActivatePowerUp();
            }
        }


        float scroll = Input.mouseScrollDelta.y;

        if (scroll != 0)
        {
            SelectPowerUp(current + (int)scroll);
        }


        if (Input.GetMouseButtonDown(0))
        {
            if (current - 1 < 0)
            {
                return;
            }
            PowerUp temp = powerUps[current];
            powerUps[current]     = powerUps[current - 1];
            powerUps[current - 1] = temp;

            inventoryUI.ChangeSlotsPosWithPrevious(current);
            current--;
        }
        if (Input.GetMouseButtonDown(1))
        {
            if (current + 1 > powerUps.Count - 1)
            {
                return;
            }
            PowerUp temp = powerUps[current];
            powerUps[current]     = powerUps[current + 1];
            powerUps[current + 1] = temp;

            inventoryUI.ChangeSlotsPosWithPrevious(current + 1);
            current++;
        }
    }