Пример #1
0
 public void pickup()
 {
     table.positionBool[itemPos] = false;
     table.tableSpaces--;
     inventory.addToInventory();
     gameObject.SetActive(false);
 }
Пример #2
0
 public void pickupVeg()
 {
     for (int i = 0; i < Gen.plots.Count; i++)
     {
         if (Gen.gridpos(Gen.plots[i].transform.position.x, Gen.plots[i].transform.position.y) == Gen.gridpos(plotPos.transform.position.x, plotPos.transform.position.y))
         {
             if (Gen.plots[i].GetComponent <CheckIsScraped>().isFinishedGrowing == true && Gen.plots[i].GetComponent <CheckIsScraped>().nameOfVeg != "")
             {
                 inventory.addToInventory(Gen.plots[i].GetComponent <CheckIsScraped>().nameOfVeg);
                 Gen.plots[i].GetComponent <SpriteRenderer>().sprite            = Gen.plotTiles[1];
                 Gen.plots[i].GetComponent <CheckIsScraped>().isPlanted         = false;
                 Gen.plots[i].GetComponent <CheckIsScraped>().needsWater        = false;
                 Gen.plots[i].GetComponent <CheckIsScraped>().isFinishedGrowing = false;
                 Gen.plots[i].GetComponent <CheckIsScraped>().wateredCount      = 0;
             }
         }
     }
 }
Пример #3
0
    void inventoryControls()
    {
        if (shopMenu.active == true && inventory.inventoryControl == false)
        {
            if (Gamepad.current.dpad.ReadValue() == new Vector2(0, 1) && isPressed == false)
            {
                if (currentSlot > 0)
                {
                    do
                    {
                        currentSlot--;
                    }while (shopList[currentSlot].name == "");

                    arrow.rectTransform.anchoredPosition = new Vector3(arrow.rectTransform.anchoredPosition.x, slotText[currentSlot].rectTransform.anchoredPosition.y);

                    isPressed = true;
                }
            }
            else if (Gamepad.current.dpad.ReadValue() == new Vector2(0, -1) && isPressed == false)
            {
                if (currentSlot >= 0 && currentSlot < shopList.FindLastIndex(x => x.name != ""))
                {
                    do
                    {
                        currentSlot++;
                    }while (shopList[currentSlot].name == "");
                    arrow.rectTransform.anchoredPosition = new Vector3(arrow.rectTransform.anchoredPosition.x, slotText[currentSlot].rectTransform.anchoredPosition.y);

                    isPressed = true;
                }
            }
            else if (Gamepad.current.dpad.ReadValue() == new Vector2(0, 0))
            {
                isPressed = false;
            }

            if (Gamepad.current.aButton.ReadValue() == 1 && !isPressedSelect)
            {
                if (inventory.money >= shopList[currentSlot].buyValue)
                {
                    inventory.addToInventory(shopList[currentSlot].name);
                    inventory.money -= shopList[currentSlot].buyValue;
                    isPressedSelect  = true;
                }
            }
            else if (Gamepad.current.aButton.ReadValue() == 0)
            {
                isPressedSelect = false;
            }
        }



        if (Gamepad.current.dpad.ReadValue() == new Vector2(1, 0))
        {
            arrow.gameObject.SetActive(true);
        }
        else if (Gamepad.current.dpad.ReadValue() == new Vector2(-1, 0))
        {
            inventory.inventoryControl = true;
            inventory.arrow.color      = new Color32(255, 255, 255, 255);
            arrow.gameObject.SetActive(false);
        }
    }