Beispiel #1
0
    private void UpdateFridge()
    {
        float anchorX = FridgeMenu.GetComponent <RectTransform>().anchoredPosition.x;
        float anchorY = FridgeMenu.GetComponent <RectTransform>().anchoredPosition.y;

        if (fridgeVisible)
        {
            if (FridgeMenu.GetComponent <RectTransform>().anchoredPosition.y > -215)
            {
                FridgeMenu.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, anchorY - 1200 * Time.deltaTime);
            }
            else
            {
                FridgeMenu.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, -215);
            }

            if (!FridgeMenu.activeSelf)
            {
                FridgeMenu.SetActive(true);
            }
        }
        else
        {
            if (FridgeMenu.GetComponent <RectTransform>().anchoredPosition.y < 215)
            {
                FridgeMenu.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, anchorY + 1200 * Time.deltaTime);
            }
            else
            {
                FridgeMenu.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, 215);
            }

            if (FridgeMenu.GetComponent <RectTransform>().anchoredPosition.y >= 215 && OvenMenu.activeSelf)
            {
                FridgeMenu.SetActive(false);
            }
        }

        if (FridgeMenu.GetComponent <FridgeManager>().CurrentFridge != null)
        {
            for (int i = 0; i < 15; i++)
            {
                int currentIndex = player.hotbar.FRIDGE_START_INDEX + i;
                if (FridgeMenu.GetComponent <FridgeManager>().CurrentFridge.stored[i] == null)
                {
                    player.hotbar.slots[currentIndex].item = null;
                }
                else if (FridgeMenu.GetComponent <FridgeManager>().CurrentFridge.stored[i] != player.hotbar.slots[currentIndex].item)
                {
                    player.hotbar.slots[currentIndex].item = FridgeMenu.GetComponent <FridgeManager>().CurrentFridge.stored[i].GetComponent <Item>();
                }
            }
        }
    }
Beispiel #2
0
 public void ExitFridge()
 {
     fridgeVisible = false;
     FridgeMenu.GetComponent <FridgeManager>().CurrentFridge = null;
     FindObjectOfType <AudioManager>().Play("oven");
 }