Beispiel #1
0
    public void OpenCraftingTable()
    {
        if (craftingPanel.activeSelf)
        {
            CloseAllWindows();
        }
        else
        {
            CursorControll.UnlockCursor();
            HideHUD.Hide();
            CloseAllWindows();
            craftingPanel.SetActive(true);
            inventoryPanel.SetActive(true);
            craftingTier = 1;

            /*
             * foreach (Crafting.CraftingClass crft in craftingScript.craftItems)
             * {
             *  if (crft.tier == 1)
             *  {
             *      crft.btn.interactable = true;
             *  }
             * }
             */
        }
    }
Beispiel #2
0
 void OpenInventory()
 {
     if (inventoryPanel.activeSelf)
     {
         CloseAllWindows();
     }
     else
     {
         for (int i = 0; i < items.Count; i++)
         {
             if (items[i].item > 0)
             {
                 items[i].text.transform.parent.gameObject.SetActive(true);
             }
             else
             {
                 items[i].text.transform.parent.gameObject.SetActive(false);
             }
         }
         inventoryPanel.SetActive(true);
         craftingPanel.SetActive(true);
         foreach (Building.BuildingsClass build in buildingScript.buildings)
         {
             build.key = false;
         }
         CursorControll.UnlockCursor();
         foreach (ItemsClass itm in items)
         {
             itm.text.text = itm.item.ToString();
         }
         craftingTier = 0;
         HideHUD.Hide();
     }
 }
Beispiel #3
0
 void Update()
 {
     if (Input.GetButtonDown("Cancel"))
     {
         if (menu.activeSelf)
         {
             CursorControll.LockCursor();
             Time.timeScale = 1;
             menu.SetActive(false);
             crosshair.SetActive(true);
         }
         else
         {
             CursorControll.UnlockCursor();
             Time.timeScale = 0;
             menu.SetActive(true);
             crosshair.SetActive(false);
             if (settingsScript.panels[5].activeSelf)
             {
                 foreach (GameObject panel in settingsScript.panels)
                 {
                     panel.SetActive(false);
                 }
                 settingsScript.panels[4].SetActive(true);
             }
         }
     }
 }
Beispiel #4
0
 public void OpenCampfire()
 {
     if (smeltingPanel.activeSelf)
     {
         CloseAllWindows();
     }
     else
     {
         CursorControll.UnlockCursor();
         HideHUD.Hide();
         CloseAllWindows();
         smeltingPanel.SetActive(true);
         inventoryPanel.SetActive(true);
     }
 }
Beispiel #5
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.T) && !input.isFocused)
     {
         if (Cursor.visible)
         {
             CursorControll.LockCursor();
             inputField.SetActive(false);
             input.DeactivateInputField();
         }
         else
         {
             CursorControll.UnlockCursor();
             inputField.SetActive(true);
             input.Select();
             input.ActivateInputField();
         }
     }
 }
Beispiel #6
0
    void Update()
    {
        healthSlider.value = health;
        energySlider.value = energy;
        hungerSlider.value = hunger;
        thirstSlider.value = thirst;
        moneyText.text     = (int)money + "€";

        /* MONEY CONTROL SECTION */

        if (money >= maxMoney)
        {
            money = maxMoney;
            StartCoroutine(Notifications.Call("You can't have more money!"));
        }

        /* ENERGY CONTROL SECTION */

        if (energy > 0)
        {
            energy -= Time.deltaTime / 10;
        }

        if (energy >= 100)
        {
            energy = 100;
        }

        /* THIRST CONTROL SECTION*/

        if (thirst > 0 && thirstSaturation <= 0)
        {
            thirst -= Time.deltaTime / 7;
        }

        if (thirst >= 100)
        {
            thirst = 100;
        }

        /* AIR CONTROL SECTION*/

        if (transform.position.y <= waterLevel)
        {
            if (air > 0)
            {
                air -= Time.deltaTime;
            }
        }
        else
        {
            if (air > 0)
            {
                air = 70;
            }
        }

        /* SATURATION CONTROL SECTION */
        if (hungerSaturation > 0)
        {
            hungerSaturation -= Time.deltaTime;
        }

        if (thirstSaturation > 0)
        {
            thirstSaturation -= Time.deltaTime;
        }

        /* HUNGER CONTROL SECTION */
        if (hunger > 0 && hungerSaturation <= 0)
        {
            hunger -= Time.deltaTime / 9;
        }

        if (hunger >= 100)
        {
            hunger = 100;
        }

        /* DAMAGE CONTROL SECTION*/
        if (health >= 100)
        {
            health = 100;
        }

        if (damagePanel.activeSelf)
        {
            damagePanel.SetActive(false);
        }

        if (hunger <= 0 && (thirst <= 0))
        {
            health -= Time.deltaTime * 3;
            if (damagePanel.activeSelf == false)
            {
                damagePanel.SetActive(true);
            }
        }

        else
        {
            if (hunger <= 0 || thirst <= 0 || energy <= 0)
            {
                health -= Time.deltaTime * 1.5f;
                if (damagePanel.activeSelf == false)
                {
                    damagePanel.SetActive(true);
                }
            }
        }

        if (air <= 0)
        {
            health -= Time.deltaTime * 2;
        }

        /* DEATH CONTROL SECTION*/
        if (health <= 0)
        {
            if (deathPanel.activeSelf == false)
            {
                deathPanel.SetActive(true);
                CursorControll.UnlockCursor();
            }
        }
    }