Пример #1
0
    public void restartBtn()
    {
        deathUI.SetActive(false);

        //#region reset sliders
        //fatigueSlider.maxValue = fatigueMax;
        //fatigueSlider.value = fatigueMax;

        //hpSlider.maxValue = hpMax;
        //hpSlider.value = hpMax;

        //thirstSlider.maxValue = thirstMax;
        //thirstSlider.value = thirstMax;

        //hungerSlider.maxValue = hungerMax;
        //hungerSlider.value = hungerMax;

        //staminaSlider.maxValue = stamMaxNorm;
        //staminaSlider.value = stamMaxNorm;

        //stamFallRate = 1;
        //stamRegainRate = 1;
        //#endregion

        disableManager.EnablePlayer();
    }
Пример #2
0
 public void SleepBtn(PlayerVitals playerVitals)
 {
     playerVitals.fatigueSlider.value = sleepSlider.value * hourlyRegen;
     playerVitals.fatMaxStamina       = playerVitals.fatigueSlider.value;
     playerVitals.staminaSlider.value = playerVitals.normMaxStamina;
     sleepSlider.value = 1;
     disableManager.EnablePlayer();
     sleepUI.SetActive(false);
 }
    public void SleepBtn(PlayerVitals playerVitals)
    {
        playerVitals.fatigueSlider.value = sleepSlider.value * hourlyRegen;
        playerVitals.stamMaxFat          = playerVitals.fatigueSlider.value;
        playerVitals.staminaSlider.value = playerVitals.stamMaxNorm;
        playerVitals.fatStage1           = true;
        playerVitals.fatStage2           = true;
        playerVitals.fatStage3           = true;

        sleepSlider.value = 1;
        disableManager.EnablePlayer();
        sleepUI.SetActive(false);
    }
Пример #4
0
    public void SleepBtn(SurvivorTraits survivorTraits)
    {
        // Sets the fatigue slider value equal to the sleep slider value * the hourly regen.
        survivorTraits.fatigueSlider.value = sleepSlider.value * hourlyRegen;
        // Sets the fatigue max stamina equal to the fatigue slider value
        survivorTraits.fatMaxStamina = survivorTraits.fatigueSlider.value;
        // Sets the stamina slider value equal to the normal max stamina value;
        survivorTraits.staminaSlider.value = survivorTraits.normMaxStamina;

        survivorTraits.fatStage1 = true;
        survivorTraits.fatStage2 = true;
        survivorTraits.fatStage3 = true;

        sleepSlider.value = 1;

        //Set The Time of Day
        dayNightManager.currentTimeOfDay = 0.23f;
        disableManager.EnablePlayer();
        sleepUI.SetActive(false);
    }
Пример #5
0
 public void HideInventoryUI()
 {
     inventoryCanvas.SetActive(false);
     dm.EnablePlayer();
 }
Пример #6
0
    void Awake()
    {
        dm = GameObject.FindGameObjectWithTag("DisableController").GetComponent <DisableManager> ();

        dm.EnablePlayer();
    }
Пример #7
0
    private void Update()
    {
        #region show inventory
        if (Input.GetKeyDown(KeyCode.I))
        {
            inventoryEnabled = !inventoryEnabled;


            if (inventoryEnabled)
            {
                inventoryUI.SetActive(true);
                disableMan.DisablePlayer();
            }
            else
            {
                inventoryUI.SetActive(false);
                disableMan.EnablePlayer();
            }
        }
        #endregion

        if (inventoryEnabled)
        {
            #region drop item
            if (Input.GetKeyDown(KeyCode.Q))
            {
                if (active != null && active.item != null)
                {
                    if (active.item.equippable)
                    {
                        Unequip(eq[(int)active.item.eqPart]);
                        ((GameObject)Instantiate(Resources.Load(active.item.name), spawnPoint.position, spawnPoint.rotation)).AddComponent <Rigidbody>();
                    }
                    else
                    {
                        Instantiate(Resources.Load(active.item.name), spawnPoint.position, spawnPoint.rotation);
                    }
                    RemoveItem(active);
                }
            }

            if (Input.GetMouseButtonDown(0) && !hold)
            {
                if (active != null && active.item != null)
                {
                    slotMove = active;
                    hold     = true;
                }
            }
            if (Input.GetMouseButtonUp(0) && hold)
            {
                if (active != null)
                {
                    if (active.tag == "Equip")
                    {
                        EquipItem(slotMove);
                        hold = false;
                    }
                    else
                    {
                        ChangeSlot(slotMove, active);
                        hold = false;
                    }
                }
                else
                {
                    //if destination is not slot
                    ChangeSlot(slotMove, active);
                    hold = false;
                }
                slotMove = null;
            }
            #endregion

            if (Input.GetMouseButtonDown(1)) // Use item
            {
                if (active != null && active.item != null && !active.item.equippable)
                {
                    UseItem(active);
                }
                else if (active != null && active.item != null && active.item.equippable)
                {
                    EquipItem(active);
                }
            }
        }
    }