示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Y))
        {
            saveManager.AddBatteries(5);
        }

        #region Swipe or button change
        if (SwipeActive)
        {
            leftMovement_BTN.SetActive(false);
            rightMovement_BTN.SetActive(false);
        }
        else
        {
            leftMovement_BTN.SetActive(true);
            rightMovement_BTN.SetActive(true);
        }
        #endregion

        //this region is used when the player decided to continue after use the pause
        #region Counter Region
        if (count_Pause)
        {
            if (counter_Pause > -0.1f)
            {
                counter_Pause -= Time.unscaledDeltaTime;
                Time.timeScale = 0;
            }
            if (counter_Pause <= 0.1f)
            {
                allPanels.counter_Panel.SetActive(false);
                allPanels.uI_Panels_Manager.OpenInGame(1);
                Time.timeScale = 1;
            }
            Counter_text_TMPRO.text = counter_Pause.ToString("0");
        }



        #endregion

        //this region is used to change the slider value when the player have been disconnected
        #region Counter Battery Region - SLIDER
        if (count_Disconnection && charged == false)
        {
            if (counter_Disconnection > -0.1f)
            {
                counter_Disconnection -= Time.unscaledDeltaTime;
            }
            if (counter_Disconnection <= 0.1f)
            {
                Disconnect();
            }
            allPanels.Battery_Slider.value = counter_Disconnection;
        }


        #endregion

        //chek if can buy a recharge
        #region Cheker Buy
        if (saveManager.state.batteriesAmount <= rechargeValue)
        {
            allPanels.reconnect_BTN.interactable = false;
        }
        else
        {
            allPanels.reconnect_BTN.interactable = true;
        }
        #endregion
    }