Esempio n. 1
0
    void Dig()
    {
        if (GetStamina() < 0.5f)
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            MouseLBtnPressTime = 0;
            UIS.Dig_Bar.transform.parent.gameObject.SetActive(true);
        }

        MouseLBtnPressTime += Time.deltaTime;

        UIS.ChangeBarValue("Dig", MouseLBtnPressTime / DigTime);

        if (MouseLBtnPressTime >= DigTime)
        {
            MouseLBtnPressTime = 0;
            int DigPercent = Random.Range(0, 101);

            if (DigPercent <= 90)
            {
                InvenM.InsertItem(ItemB.Items[1]);
            }

            if (DigPercent > 80 && DigPercent <= 90)
            {
                InvenM.InsertItem(ItemB.Items[1]);
            }
            UseStamina(10f);
            UIS.ChangeBarValue("Stamina", GetStamina() / 100);
        }
    }